Question

I have a little problem with an alert View, the idea is that when the app starts, it asks on background for new data for the app, so after receiving the information an AlertView should be shown if there is new data. The problem comes because the AlertView is only shown on the main activity where I launched the asyncTask, so if I'm already in other activity, the alert will appear when I come back to the main activity and the Idea is that the AlertView is displayed in whatever activity the user is in.

My first thought was that the Context that I send to the AsyncTask is the problem so I've tried using getApplicationContext() so the app crashes in the moment of creating the alertView. So I'm, looking for a way to display this AlertView or something equivalent on the screen wherever he is on the app, does any one have ideas?

any idea would be greatly appreciated

Était-ce utile?

La solution

you can use broadcastreceiver in every activity which will contineous monitor your background service contineous whenever event occoured using broadcastreceiver display alertbox with content received by receiver.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top