Updating UI from service: How to access progress bar from a service?
Send progressbar id through intent extras & access it in service
Make progress bar as static variable in activity, and access that variable from service.
If you want to touch UI from service, trigger a dynamically registered receiver in activity from service. And update UI from that dynamic receiver with in that activity.
put all UI controls in a common class and access it from all components.
Both option 1 is wrong way of communication design. all UI controlling has to be done in activity to reduce side effects. if a services wants to touch UI, send a broadcast from service which triggers a receiver in activity which is dynamically registered in activity for communication. from that receiver you can touch UI since it is inner class of it.
Back To Top