I'm writing a program for my toddler and I'm running into a problem.

I call mediaplayer numerous times.  Each time a button is clicked it
runs media player, but it's a different sound.  So should I create a
new instance each time?

Here's what I'm looking at...



                                if(buttonClicked == button1)
                                {
                                    MediaPlayer mp = 
MediaPlayer.create(getBaseContext(),
R.raw.sound0);
                                    mp.start();
                                    mp.release();
                                }
                                else if(buttonClicked == button2)
                                {
                                    MediaPlayer mp = 
MediaPlayer.create(getBaseContext(),
R.raw.sound1);
                                    mp.start();
                                    mp.release();
                                }


Now that seems to work fine on the emulator.  When I pack it up into
an APK and put it on my G1 I can only do it 7 times before it force
closes.  I BELIEVE the memory gets full or something.
-- 
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