title: Oncompletion Listener in android Media player
body: <p>I want to play MediaPlayer one after other, i can able to get first file but could not able to get remaining files... </p>
  
  <p>whether this code is correct...</p>
  
  <pre><code>private void playRecording()  {
  
      player = new MediaPlayer();
  
      player.setOnCompletionListener(new OnCompletionListener() {
          @Override
          public void onCompletion(MediaPlayer mp) {
              // TODO Auto-generated method stub
              player.stop();
              if (i &lt; numberOfFiles) {
  
                  i++;
                  playAudio(Environment.getExternalStorageDirectory()
                          .getAbsolutePath()
                          + "/android"
                          + i
                          + ".3gp");
              }else i=0;
          }
  
  
      });
      player.start();
  </code></pre>
  
  <p>playAudio:</p>
  
  <pre><code>  private void playAudio(String filename) {
        try {
        player.setDataSource(filename); 
        player.prepare();
        player.start();
    } catch (Exception e) { 
        // TODO Auto-generated catch block
        e.printStackTrace(); 
        } 
        }
  </code></pre>