Multimedia

Reference

http://developer.android.com/reference/android/media/MediaPlayer.html

Play audio

public void audioPlayer(String path, String fileName){
    MediaPlayer mp = new MediaPlayer();
    try {
        mp.setDataSource(path+"/"+fileName);
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (IllegalStateException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    try {
        mp.prepare();
    } catch (IllegalStateException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    mp.start();
}

Wait till finished

mPlayer.setOnCompletionListener(new
    OnCompletionListener() {        
        @Override
        public void onCompletion(MediaPlayer arg0) {
        Intent stopplay= new Intent(MyRecording.this,Recorded_Message.class);
        startActivity(stopplay);                
    }
});
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License