I put in background of my android application a song. I don't know how much time the application is open. And I want to put this song to repeat. My code is:
MediaPlayer mySong;
mySong = MediaPlayer.create(X_0Activity.this, R.raw.tj);
mySong.start();
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); // for repeat song
mPlayer.start();