多个播放器的选择使用
public void PlayRingFile(View view) { switch (view.getId()) { case R.id.Button01: if (mp2.isPlaying()) { mp2.stop(); // stops the object from playing mp2.release(); // always a good practice to release the resource } MediaPlayer mp1 = MediaPlayer.create(this.getApplicationContext(), R.raw.aaa); mp1.start(); break; case R.id.Button02: if (mp1.isPlaying()) { mp1.stop(); // stops the object from playing mp1.release(); // always a good practice to release the resource } MediaPlayer mp2 = MediaPlayer.create(this.getApplicationContext(), R.raw.bbb); mp2.start(); break; } } ?