Is there any way i can update 4 activity UI from a background service?
I have 4 activity with 4 image view, i want to update the image every 30 seconds.
All the activity should be update together.
Anyone can show me how to do that?
Is there any way i can update 4 activity UI from a background service?
Share
Instead of updating directly from Service, I think the Listener Pattern would be a better choice. You can do this in two ways:
Classic Listener Pattern of Java. You define a listener interface for your Activities, and update is called from the Service.
Android Specific. Use Broadcast to broadcast such an update intent from your Service class, and your Activity create an object to receive the broadcast.
Since your update period is measured in seconds, second approach could be easier and more scalable, so it is preferred.