I'm writing an music player app. I have the MediaPlayer object in a service. The problem is that I don't know how to update the UI from service. By example I want to update the remaining time from current song but - because the MediaPlayer is on service - I can't set a listener to MediaPlayer object.
I was thinking about sending a broadcast message with current time but if I'll do it in this way, I have to send a message on every second. I suppose this will affect the speed of application + battery life.
Another solution can be to create a public static
variable in Service and access it from activity but I read that this is not a good option.
What do you think? Do you know any - better - way to update the UI from service?
Thank you.