majestic94 majestic94 - 10 months ago 62
Java Question

Android Radio App that streams my mp3 from a dropbox server

I have a dropbox media server that has a collection of mp3 files that I want to stream onto an android application.

I know that using the "MediaPlayer" is the best way to go in the API.

How my main concern is how do I automate the process, where music is being played one after another? As if it was like an internet radio app?

Could someone please point me in the correct location for guides or display example code would be great thank you in advance.

Answer Source

Place the music files names in an arraylist (e.g songs) then implement onCompletionListener then set it to your media player. Inside the listener restart the media player to play the next item.


 public void onCompletion(MediaPlayer arg0) {
      if (counter < songs.size()) {
        arg0 = MediaPlayer.create(getApplicationContext(), songs.get(counter);