I thought I had solved this problem here http://groups.google.com/group/android-developers/browse_thread/thread/260f2951d4a23445/d676c2a7d6b66c20?hl=en&lnk=gst&q=onpreparedlistener#d676c2a7d6b66c20
but apparently not. 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 stand-alone library class (call it MyMediaPlayer) is created by passing the Activity Context to it's constructor. I then use getApplicationContext to avoid any potential memory leaks. My problem is trying to use callbacks. When I implement MediaPlayer.OnPreparedListener in my library class, it doesn't ever get called. To test this further, I created a separate project, that has a single activity, that also implements the OnPreparedListener. In that project, the onPreparedListener is called, and it works. Both are coded this way: (mp = MediaPlayer, and the MyMediaPlayer class implements/overrides OnPreparedListener) mp = MediaPlayer.create(context, resourceId); mp.setOnPreparedListener(this); The only difference that I can see is that the library class doesn't extend activity, and is not related to the passed context. This may be a requirement for the callback, but I'm not sure. Does anyone know how to make a non-activity class receive the callbacks from MediaPlayer? I hate the thought of re-creating media player code in each and every activity that it's used in. Thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

