Skip to content Skip to sidebar Skip to footer

Android Getting Activity Instance In Application From Handler

I am using Handler for communicating between Current Activity and a subclass of Application. Subclass is having a thread which processes web service calls. Subclass may also have a

Solution 1:

Have you tried sending the Instance of the Activity using a Message with parameter msg.obj?

Btw, I think you should be using a AsyncTask instead of riddling it with complicated code.

Solution 2:

The application class is unaware of what activity is running.

The only thing that can be done is to let application class know about activity is by a setter method which is not recommended as it may lead to memory problems.

Post a Comment for "Android Getting Activity Instance In Application From Handler"