Android – How to get data from a service thats already running

android

I have a service that runs once the app starts and I was wondering how can I get data from that service to an activity at anytime without having to restart the service

Best Answer

No offense, but the "Messenger" and "binding" way kept me busy for about 2 days to figure out. Not that it's wrong, but it overcomplicated things for me.

In my opinion its easier for a service to broadcast the data so that an Activity can just access the data when available. Do the tutorial on this link: http://www.websmithing.com/2011/02/01/how-to-update-the-ui-in-an-android-activity-using-data-from-a-background-service/comment-page-1/#comment-734

(took me 10minutes to figure out and implement... excellent tutorial)