Thursday, June 30, 2011

[android-developers] MediaPlayer and IllegalStateException

I've try to copy a very small and easy sample of using MediaPlayer
(for example in
but I dont know the reason I get an IllegalStateException.

Code can be sumarized as:
MediaPlayer mp = MediaPlayer.create(myclass_name_here.this,
boolean error=true;
try {
} catch (IOException ioe) {
Log.w("Player","Error: "+ioe.getMessage());
if(!error) {

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
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment