Reputation: 35
I have few activities and a single service in my app. Most of these activities need to bind to this service and use the services offered by it. There is only one entry point into the app and that activity binds to this service. Once the service is bound i get the instance of my service and save it in a static reference. Would it be okay if i use this same static reference in other activities to make use of the services offered by the service? Or do I have to bind to the service from every activity that wants to use the service?
Upvotes: 0
Views: 69
Reputation: 12435
Maybe it is even better to start service from "entry point activities" and then to bind other activities to the service when u need it later..
Upvotes: 0
Reputation: 11645
No. You should update each individual Activity to bind to the service. You should not count on a static reference being retained in memory.
Upvotes: 1