Thanks for the tip! This actually does the trick. What I'm doing now
is a bit more complex. I've created a helper class that multiplies the
number of MediaPlayers used. So instead of using one MediaPlayer for
the bingSound, I use a new class, which internally creates an array of
MediaPlayers. bingSound is an instance of this helper class. If i call
bingSound.play(), the helper class initializes the first MediaPlayer
in the array and starts it.

When bingSound.play() is called again, the helper class takes the
second MediaPlayer in the array and so on. With this I can fire off
the same sound very quickly several times, without having to make sure
that the sound has finished before it can be played once more.

For all MediaPlayers created I set the onCompletionListener as you
suggested with the effect you described: the system does not fill up
with MediaPlayer remnants any more.

With this everything works fine now. All in all pretty complex though.

On 29 Okt., 09:27, blindfold <[EMAIL PROTECTED]> wrote:
> With option 2, did you try using a setOnCompletionListener() with a
> bingSound.stop() and bingSound.release()? This cleaning up ought to
> prevent your system from filling up with MediaPlayer remnants - unless
> of course you make so many calls to bingSound.start() per unit of time
> that the system has no chance (on average) to finish playing one
> bingSound before the next bingSound request already comes in. This
> approach works for me.
>
> Regards
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to