OnCompletionListener
<p>Anyone explain me how to use OnCompletionListener in android program to play audio one after another...here cannot able to get second audio file..</p>

<pre><code>private void playRecording() throws IllegalArgumentException,
        SecurityException, IllegalStateException, IOException {

    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");
            }
        }
    });
    player.start();

}

private void playAudio(String filename) {

    try {

        Toast.makeText(getApplicationContext(), filename, Toast.LENGTH_LONG)
                .show();
        player.setDataSource(filename);
        player.prepare();
        player.start();

    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
</code></pre>
