Hello, I have a small issue here I am running Eclipse 3.5x in Ubuntu
9.10 and have a MyTouch 3g running 1.6 Cupcake.
I created a small app similar to a soundboard as one of my first apps,
though I seem to be having issues with MediaPlayer.  I have never
written a line of code in Java before, so I am severely new to this
all, yet I have coded in Perl for many years.

Here is a part of my code in the main.java file:

[code]
        Button Button01 = (Button)this.findViewById(R.id.Button01);
        Button01.setOnClickListener(new OnClickListener() {


                        public void onClick(View arg0) {

                                        final MediaPlayer mp1 = 
MediaPlayer.create(SoundBoard.this,
                                                R.raw.one);
                                try {
                                        mp1.prepareAsync();
                                } catch (IllegalStateException e) {
                                        // TODO Auto-generated catch block
                                        e.printStackTrace();
                                }
                                  new Thread(new Runnable() {
                                            public void run() {
                                                mp1.start();
                                            }
                                          }).start();


                        }
            });
[/code]

I have one of those blocks for each button (about 12).  And they work
fine except if I press more than 7 buttons or one button more than 7
times, i get a force close.  Does this mean I used up all alloted
memory for this process?  I tried using release() and reset() but
neither would play the mp3.  As you can see, I also tried putting the
start() call into a thread of it's own, thinking it was stealing
memory from the UI?  I feel lost.  Can anyone help me?  Thanks.


~Douglas.

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