title: Is it possible to have MediaPlayer play one audio file and when it finishes play the next?
body: <p>I want MediaPlayer to take in an arraylist of songTitles and have it check which song title came in, then play that song. When it finishes, I then want it to go to the next song title in the loop and play that one. However, my code only plays the last song. </p>
  
  <pre><code>public void play(Context c, ArrayList&lt;String&gt; songTitles) {
      stop();
  
      for (String song: songTitles){
          if (song.equalsIgnoreCase("shakeItOff")){
              mSongPlayer = MediaPlayer.create(c, R.raw.shaketoff);
  
          } else if (song.equalsIgnoreCase("dropItLow")){
              mSongPlayer = MediaPlayer.create(c, R.raw.dropitlow);
  
          } else if (song.equalsIgnoreCase("chachaslide")){
              mSongPlayer = MediaPlayer.create(c, R.raw.chachaslide);
          }
  
          mSongPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
              @Override
              public void onPrepared(MediaPlayer mp) {
                  if (mp == mSongPlayer) {
                      mSongPlayer.start();
                  }
              }
          });
  
          mSongPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
              @Override
              public void onCompletion(MediaPlayer mp) {
                  stop();
              }
          });
  
  
      }
  }
  </code></pre>