Reputation: 8397
I have an API Object that I made, and I would like to share it between a running Service and various Activities in my app, almost like if I was to make the class static. How could I go about sharing the created object between the two?
Upvotes: 1
Views: 3914
Reputation: 8397
I figured out the best way to do this is to have a class that holds all the information that you want, and to use that class through each activity and service.
Upvotes: 0
Reputation: 11741
You may find the following helpful.
Binding a Service to an android.app.Activity vs Binding it to an android.app.Application
Android Service interacting with multiple activities
Alternatives for Pushing data from an Android Service to an Activity
Upvotes: 1