I have an activity with multiple fragment views (they get replaced with other fragments)
One of these fragments has an ASyncTask. This ASyncTask queries a webserver, parses the response. Inserts the response data into a database and finally updates the UI using the onPostExecute method.
Now I am planning to update the database,by querying the webserver, every hour. But now I am struggling with how I am going to implement this.
I would like to combine the asynctask and the hourly update into one task. I guess it would be best to use a IntentService with an AlarmManager but I also need to update the UI if the request came from a Fragment.
Is their any elegant/simple way to implement this feature.
Sidenotes: i need the fragment ui also to update after an orientation change or when the user pauses the app.