title: Media Player stream url, then play next url
body: <p>I'm currently have a media player that is streaming an mp3 file. When that file is done, what is the code so that it goes to the next url/mp3?</p>
  
  <p>And also, is there code to get the name of the file and display it? how would I go about doing that?</p>
  
  <p>thanks </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>see my code below:</p>
  
  <pre><code>package com.example.m3uplayer;
  
  import android.app.Activity;
  import android.media.AudioManager;
  import android.media.MediaPlayer;
  import android.net.Uri;
  import android.os.Bundle;
  import android.media.MediaPlayer.OnCompletionListener;
  
  public class m3uPlayer extends Activity implements MediaPlayer.OnCompletionListener {
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          //
  
          //http://dl.dropbox.com/u/24535120/AfroJack-UMF11-clip2.mp3
  
          //http://dl.dropbox.com/u/24535120/Avicii%20clip%201.mp3
  
  
          Uri myUri = Uri.parse("http://dl.dropbox.com/u/24535120/AfroJack-UMF11-clip2.mp3");
  
          MediaPlayer sdrPlayer = new MediaPlayer();
  
          try {
              sdrPlayer.setDataSource(this, myUri);//"http://mp1.somafm.com:8032");
              sdrPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
              sdrPlayer.prepare(); //don't use prepareAsync for mp3 playback
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
          sdrPlayer.start();
      }
  
      @Override
      public void onCompletion(MediaPlayer sdrPlayer) {
          Uri myUri5 = Uri.parse("http://dl.dropbox.com/u/24535120/Avicii%20clip%201.mp3");
  
          try {
              sdrPlayer.setDataSource(this, myUri5);
              sdrPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
              sdrPlayer.prepare(); //don't use prepareAsync for mp3 playback
          } catch (IllegalArgumentException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          } catch (SecurityException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          } catch (IllegalStateException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
          sdrPlayer.start();
      }
  }
  </code></pre>