代码
private MediaPlayer mRingPlayer; /** * 播放铃声 */ private void startRing(){ if (mRingPlayer != null){ mRingPlayer.stop(); mRingPlayer.release(); mRingPlayer = null; } mRingPlayer = MediaPlayer.create(this, R.raw.video_request); mRingPlayer.setLooping(true); mRingPlayer.start(); } /** * 停止铃声 */ private void stopRing(){ if (mRingPlayer != null){ mRingPlayer.stop(); mRingPlayer.release(); mRingPlayer = null; } }