Search code examples
androidserviceandroid-mediaplayermedia-playeraudio-streaming

How to update UI in real-time from service?


I know, that for correct architecture of media player app we need to use service for player logic. So how i can update UI from service in real-time for my FRAGMENTS? I need to bind service to host activity and...? Or not? Help me please


Solution

  • Use RxJava or EventBus to send your data to fragment and then in fragment update ui.

    be careful in fragment you must use runOnUiThread.