我想像textview一样更新我的UI组件,但localbinder,onbind,onStartCommand是jodispatcher库中jobservice的最终版本,这样我就可以在我的活动中实现绑定服务,就像下面的代码一样:
/** Defines callbacks for service binding, passed to bindService() */
private ServiceConnection mConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName className,
IBinder service) {
// We've bound to LocalService, cast the IBinder and get LocalService instance
LocalBinder binder = (LocalBinder) service;
mService = binder.getService();
mBound = true;
}
@Override
public void onServiceDisconnected(ComponentName arg0) {
mBound = false;
}
};