首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

多个播放器的取舍使用

2012-09-22 
多个播放器的选择使用public void PlayRingFile(View view) {switch (view.getId()) {case R.id.Button01:

多个播放器的选择使用

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;          } } 

?

热点排行