views:

24

answers:

1

hi,

i seem to have a classic task, yet i can't find any examples on how to do it.

i want to download something. well i call a web service and get a response... but its pretty much the same.

in order to do this i have an activity that starts a service that spawns a thread that does the job.

now i would like to use the data i got in the activity that started the service.

(i assume that starting another activity to handle the job of displaying the result would be simple)

my problem is how does the service notify an activity (the one that started it or another one) of something.

any pointers to examples are much appreciated.

regards

+3  A: 

Send a broadcast Intent with the data via sendBroadcast(), that the activity picks up with a BroadcastReceiver. Here is a sample project that do that: http://github.com/commonsguy/cw-android/tree/master/Service/WeatherPlus/ Doc: http://developer.android.com/reference/android/content/BroadcastReceiver.html

fpanizza