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 applicati开发者_高级运维on 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
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 :-)
精彩评论