public void onServiceConnected(ComponentName name, IBinder service) {
   mService = IAndTweetService.Stub.asInterface(service);
   // We want to monitor the service for as long as we are
   // connected to it.
   try {
     mService.registerCallback(mServiceCallback);
   } catch (RemoteException e) {
     // Service has already crashed, nothing much we can do
     // except hope that it will restart.
   }
 }
 /** Disconnect and unregister the service. */
 protected void disconnectService() {
   if (mIsBound) {
     if (mService != null) {
       try {
         mService.unregisterCallback(mServiceCallback);
       } catch (RemoteException e) {
         // Service crashed, not much we can do.
       }
     }
     unbindService(mConnection);
     mIsBound = false;
   }
 }