最終更新:2016-01-19 (火) 13:47:41 (1630d)  

android.content.ServiceConnection
Top / android.content.ServiceConnection

http://developer.android.com/reference/android/content/ServiceConnection.html

メソッド

onServiceConnected

onServiceDisconnected?

メモ

  • こんな感じでServiceConnectionインターフェイスを実装する(匿名クラス)
      MyIntentService myService;
      ServiceConnection serviceConnection = new ServiceConnection(){
        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
          Log.d(TAG, "onServiceConnected");
          myService = ((MyIntentService.MyBinder)service).getService();
        }
    
        @Override
        public void onServiceDisconnected(ComponentName name) {
          Log.d(TAG, "onServiceDisconnected");
          myService = null;
        }
      };

参考