Yes there is. You will love the ResultReceiver class. To create it, you need to pass the Handler (created inside the action) and override the onReceiveResult method.
So what you do is send the ResultReceiver link to the service (using the optional Intent options), and when the XML parsing is done, you call the send method from Service . This way, your activity will be notified when XML parsing is complete.
There is a Google IO video explaining this technique. You can also download the slides used in the conference.
If you want to use the sample code, look at the iosched application. It tells how to create a ResultReceiver proxy server that will help you deal with configuration changes (for example, changes in the device) ... because, as you know, when this happens, the user interface is recreated, which can lead to memory leaks (you know, the service will point to non-existent user interface elements).
Cristian Mar 01 2018-11-11T00: 00Z
source share