I have a service that i retrieve 7 URL’s.
Oncei retrieve the URLs from the service, i want to send a broadcast with the URL stored as an extra. i want to send a broadcast when the images are finished downloading to the main activity to refresh my BaseAdapter. My Service will be the one to send the broadcasts and my Activity will be the one with the receiver.
The problem is i am downloading the Strings from a server. The MainActivity needs these before it starts.
What could i do to by time while the service downloads the Strings?
Also i thought about running tha downloading of the Strings in my main activity in an asynctask but i only want the Strings to be checked and downloaded once a week.
Is my solution the best? Could some one give me an example of how i would implement this. I am familiar with broadcast recievers. just dont know how i would use it for this particular project.
Instantiate a BroadcastReceiver inside your activity’s onCreate() method and register the receiver inside the activity’s onStart() method.
Ensure that you unregister the receiver in the activities onPause() or onStop() methods.
Register the receiver again in onResume().
For more details take a look at this