Basically I have 3 songs, and I want the user to be able to loop back to the first song once the cycle of 3 songs is complete. Why won\'t this work? It will play all 3 songs
Call the function:
MediaPlayer.setLooping(true|false)
on the mediaplayerObject after you called MediaPlayer.prepare()
Example:
Uri mediaUri = createUri(context, R.raw.media); // Audiofile in raw folder
Mediaplayer mPlayer = new MediaPlayer();
mPlayer.setDataSource(context, mediaUri);
mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mPlayer.prepare();
mPlayer.setLooping(true);
mPlayer.start();