我在A应用中定义了一个Service,想在B应用在去Bind,但在运行时虚拟机老报“无法找到类”的错误
class A extends Service {
private IRemoteService.Stub mStub = new IRemoteService.Stub() {
@Override
public int getInt() throws RemoteException {
// TODO Auto-generated method stub
return 99;
}
}; ......
}class B extends Activity {
//运行时,会报找不到IRemoteService类
void doBindService() {
bindService(new Intent(IRemoteService.class.getName()),
mConnection, Context.BIND_AUTO_CREATE);
}
}
我该如何处理?虚拟机是如何去找A应用中定义的类?我是否要将A.jar放到模拟器中?多谢!
class A extends Service {
private IRemoteService.Stub mStub = new IRemoteService.Stub() {
@Override
public int getInt() throws RemoteException {
// TODO Auto-generated method stub
return 99;
}
}; ......
}class B extends Activity {
//运行时,会报找不到IRemoteService类
void doBindService() {
bindService(new Intent(IRemoteService.class.getName()),
mConnection, Context.BIND_AUTO_CREATE);
}
}
我该如何处理?虚拟机是如何去找A应用中定义的类?我是否要将A.jar放到模拟器中?多谢!
可以解决你的问题
<service android:name="A" />