Code example for MediaPlayer: Playing audio and video

Methods: setLoopingstart

0
		for (int i=0; i<ar.length(); i++) bgmIds[i] = ar.getResourceId(i, 0);
	} 
	void start() { 
		int index = rand.nextInt(bgmIds.length);
		mediaPlayer = MediaPlayer.create(context, bgmIds[index]);
		mediaPlayer.setLooping(true);
		mediaPlayer.start();
	} 
	void stop() { 
		try { 
			mediaPlayer.stop();
		} catch (Exception e) {
			Log.e(TAG, "���f�B�A�v���[���[��stop�Ɏ��s���܂����B", e);
		} finally { 
			mediaPlayer.release();
		} 
	} 
} 
Connect your IDE to all the code out there  Get Codota for Java