由于没有给出完整的上下文和代码,建议参考以下可能的
Intent serviceIntent = new Intent(getActivity(), MyAssistService.class);
// start and bind the service
getActivity().bindService(serviceIntent, mConnection, Context.BIND_AUTO_CREATE);
private final ServiceConnection mConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
mAssistService = IMyAssistService.Stub.asInterface(service);
try {
mAssistService.registerCallback(mCallback);
} catch (RemoteException e) {
// handle the exception
}
}
@Override
public void onServiceDisconnected(ComponentName name) {
mAssistService = null;
}
};
private final IMyAssistCallback mCallback = new IMyAssistCallback.Stub() {
@Override
public void onMultiTouch(MotionEvent event) {
// handle the multi-touch event here
}
};
以上是两个常见的解决方法,具体的问题和解决方法可能需要根据上下文和代码进行进一步的分析和调试。