Skip to content Skip to sidebar Skip to footer

Is There A Sendtoactivity() Method?

I have a program with about 8 Activity classes, and 1 Application class. I want my Application class to be able to communicate with every Activity, but on its own terms. I don't wa

Solution 1:

You could use a Callback Method

Every Activity has it's own callback method and registers that method onResume() in the Application Class. (it's like an onApplicationWantsToDoSomethingWithMeListener() ;)

or why not a Service in background? instead of the Application, since what you want sounds like a Service. More details?

EDIT: I made a similar application with bluetooth, you should definetly use a Service for that, but you can communicate with your service per Application. Say the Service calls the callback in the Application look here for an implementation uf such a thing

Post a Comment for "Is There A Sendtoactivity() Method?"