private ServiceConnection mServiceConnection = new ServiceConnection() {
@Override
public void onServiceDisconnected(ComponentName name) {
mMyService.isActivityBound = false;
}
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
MyBinder myBinder = (MyBinder) service;
mMyService = myBinder.getService();
}
};
我的问题是,当我在onServiceDisconnected()方法中时,mMyService是否仍然存在并且是否绑定到它?我的意图是每次活动从我的服务绑定/取消绑定时更新布尔值isActivityBound。