Java – The best way to update UI from IntentService?

The best way to update UI from IntentService?… here is a solution to the problem.

The best way to update UI from IntentService?

I’m currently writing an application that needs to be able to play audio.
Because I want the audio to continue playing when the user leaves the application, I use IntentService to handle the playback method.

My problem is that I need to be able to update the app UI with data from the intentservice, such as a progress bar showing the amount of audio remaining.

I was just wondering what is the best way to achieve this?
I googled this, but all the guides seem to be for AsyncTask or standard services.

Thank you so much to anyone who can help.



Use the Handler and Messenger classes.

Someone has posted a good answer here (it also uses Handler and Messenger):

How to Collect info from IntentService and Update Android UI

Related Problems and Solutions