Shul
Shul

Reputation: 21

Android activity and service communication

My application builds from 2 activities and one service. The main activity is list of data (extends ListActivity). The second activity is a simple progress bar.

The service responsibility is to retrieve the data from the server. Once the user launches the application the service creates a new thread and send request to the server, since it is asynchronous request I want to display my progress bar, once the response arrived I want to display the data using the list activity.

At the moment my main activity (the list) start the service and bind with it (bindService), the main activity and the service must live and communicate until the user close the application so I implemented handleMessage at the list activity.

My problem is how to inform the progress bar activity that the data arrived, finish the progress bar (I don’t need it anymore) and display the data in the list activity Regards

Upvotes: 2

Views: 1821

Answers (1)

moritz
moritz

Reputation: 2478

Intents are what you're looking for, they are a very powerful and commonly used means of IPC on Android. The Documentation is pretty nice, so check out intents and I hope it helps :-)

Upvotes: 1

Related Questions