如何在android中的twitter应用程序中刷新时间线

时间:2011-10-12 09:27:59

标签: android twitter

public void onServiceConnected(ComponentName name, IBinder service) {
            Log.i( "Service connection established","");

            // that's how we get the client side of the IPC connection
            api = com.oreilly.android.otweet.TweetCollectorApi.Stub.asInterface(service);
            try {
                api.addListener(collectorListener);
            /*  Intent i = new Intent(StatusListActivity.this, StatusListActivity.class);
                i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(i);*/
            } catch (RemoteException e) {
                Log.e("", "Failed to add listener", e);
            }

1 个答案:

答案 0 :(得分:0)

要在申请停止时停止服务,我们需要在unbindService()中致电onDestroy()

编辑:

在您的链接中有代码

@Override
            protected void onDestroy() {
              super.onDestroy();

              try {
                api.removeListener(collectorListener);
                unbindService(serviceConnection);
              } catch (Throwable t) {
                // catch any issues, typical for destroy routines
                // even if we failed to destroy something, we need to continue destroying
                Log.w(TAG, "Failed to unbind from the service", t);
              }

              Log.i(TAG, "Activity destroyed");
            }