Code example for ContextWrapper

Methods: unbindService

      ServiceBinder sb = sConnectionMap.remove(cw);
      if (sb == null) {
          Log.e("MusicUtils", "Trying to unbind for unknown Context");
      if (sConnectionMap.isEmpty()) {
          // presumably there is nobody interested in the service at this point, 
          // so don't hang on to the ServiceConnection 
          sService = null;
  private static class ServiceBinder implements ServiceConnection {
      ServiceConnection mCallback;
      ServiceBinder(ServiceConnection callback) {
          mCallback = callback;
      public void onServiceConnected(ComponentName className, android.os.IBinder service) {
Contextual code suggestions in your IDE  Get Codota for Java