Re: [android-developers] MediaPlayer and IllegalStateException
http://developer.android.com/reference/android/media/MediaPlayer.html#create(android.content.Context, int) Convenience method to create a MediaPlayer for a given resource id. *On success, |prepare()| will already have been called and must not be called again. * -- Kostya 30.06.2011 20:11, John-Z80 ?: I have a raw directory under res, it has the "clip.mp3" file, I've check the file is ok, so why I get a java.lang.IllegalStateException in mp.prepare(); I've tested in 2 different android phones. -- Kostya Vasilyev -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] MediaPlayer and IllegalStateException
I've try to copy a very small and easy sample of using MediaPlayer (for example in http://developer.android.com/guide/topics/media/index.html) but I dont know the reason I get an IllegalStateException. Code can be sumarized as: MediaPlayer mp = MediaPlayer.create(myclass_name_here.this, R.raw.clip); boolean error=true; try { mp.prepare(); error=false; } catch (IOException ioe) { Log.w("Player","Error: "+ioe.getMessage()); } if(!error) { mp.start(); } I have a raw directory under res, it has the "clip.mp3" file, I've check the file is ok, so why I get a java.lang.IllegalStateException in mp.prepare(); I've tested in 2 different android phones. Best regards. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en