When a button is clicked the text of a textview changes and a sound is
played, but the sound is played first then the text changes.  I would
like it to happen simultaneously if not then the text to take effect
first.  Here's my code...



        public void playSound(int playingFile)
        {
                        MediaPlayer mp = MediaPlayer.create(getBaseContext(), 
playingFile);
                            mp.start();
                            while(mp.isPlaying())
                            {
                                //i put this in so the mp isn't released in 
middle of the
sound
                            }
                        mp.release();
        }

        public void onClick(View v)
        {
                if(v==button1)
                {

                                maintext.setText("2");
                                maintext.setTextColor(Color.RED);
                                playSound(R.raw.s2);
                }
         }


Can anyone see the problem?  It works, just not as I hoped.  Is there
any way this could be more efficient as well?
-- 
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