In my code there is an inner class that extends BroadcastReceiver.
And I have added the following line to the AndroidManifest.xml:
I've just met the same problem.
I have a service to communicate with many activities, and I also have a receiver in my service as inner class. when the receiver get message ,it has to call the method of service. so it goes on like this :
1. Service code:
public class XXService extends Service{
// I want the inner receiver call the methd of XXService,
// so I have to write this constructor like this.
private XXService instance;
public XXService(){instance = this;}
public XXService getInstance(){
return instance;
}
public void sayHello(){
}
public static class XXReceiver extends BroadcastReceiver{
onReceive(......){
XXService.getInstance.sayHello();
}
}
}
2. Register receiver in manifest.xml :