Yes, you're correct. I created my library class a month ago and was updating it to use callbacks. I didn't realize it was calling prepare inside the create method.
Thanks! On Wed, Feb 25, 2009 at 10:50 PM, Marco Nelissen <marc...@android.com>wrote: > > On Tue, Feb 24, 2009 at 9:55 PM, madcoder <paperga...@gmail.com> wrote: > > > > I have successfully implemented the Media Player for my apps, but when > > I tried to use some of the callback methods I ran into a problem. > > > > What I'm trying to do is use Media Player in a reusable (library) > > class. This MediaPlayer is created by passing the Activity Context to > > it's constructor. I then use getApplicationContext to avoid any > > potential memory leaks. This works well and I'm quite happy with it. > > > > My problem is trying to use callbacks. When I implement > > MediaPlayer.OnPreparedListener in my class (that doesn't extend an > > Activity) I repeatedly get this error: > > > > Illegal State Exception: PrepareAsync called in state 8 > > > > This error only occurs on the line: > > > > mp.prepare(); > > I think that means that the MediaPlayer was already prepared, i.e. you > previously called prepare() on it, or perhaps you used one of the > MediaPlayer.create() methods to create the MediaPlayer. > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---