2 znl 12 znl_12 于 2013.06.24 17:48 提问

media player 返回 IllegalStateException 错误

我使用下面的代码播放小的音频文件:

private void playVoice() {

     if (mPlayVoice != null) {
         if (mPlayVoice.isPlaying()) {
             mPlayVoice.release();
             mPlayVoice = null;
         }
     }
     mPlayVoice = 
         MediaPlayer.create(BirdsActivity.this, mSoundIds[getCurrentIndex()]);
     mPlayVoice.start();
 }

在 Samsung galaxy tab能很好的运行,但是当我在 Sony xperia mini pro上检测时,给出下面的错误:

06-17 12:45:45.232: ERROR/AndroidRuntime(6639): java.lang.IllegalStateException 08-17 12:45:45.232: ERROR/AndroidRuntime(6639): at android.media.MediaPlayer.isPlaying(Native Method) 08-17 12:45:45.232: ERROR/AndroidRuntime(6639): at com.android.mds.kidsapps.alphakids.BirdsActivity.playVoice(BirdsActivity.java:146)

2个回答

wangyaninglm
wangyaninglm   Ds   Rxr 2015.01.17 00:21
oyljerry
oyljerry   Ds   Rxr 2015.01.17 00:24

看来是兼容性问题。

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!