android播放MP3一个警告:IllegalStateException

播放MP3 警告提示prepareasync called in state 8

 

解决办法 在

 

prepared() 前调用 stop()

 

player = MediaPlayer.create(MusicService.this, R.raw.my); try { if (player != null) { player.stop(); } player.prepare(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } player.start();

你可能感兴趣的:(android,null)