MediaPlayer playing files on AVD, on PDA throwing errors
This is my method in service for playing files, on AVD everything works fine, no errors, when I click the control开发者_如何转开发 on PDA I get these LogCat events: http://pastebay.com/125483. I have no clue what is happening. Please advise.
public void playAudio (int playAudio) {
player = MediaPlayer.create(this, playAudio);
try {
if (player != null) {
player.stop();
}
player.prepare();
player.start();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
}
}
I solved it, the problem was I called prepare(); after MediaPlayer.create since it prepares the MediaPlayer already.
精彩评论