Why is MediaPlayer playing before TextView setText takes effect?

by Breezy » Tue, 19 Jan 2010 10:41:12 GMT

Sponsored Links
 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(), 
                                //i put this in so the mp isn't released in 
middle of the

        public void onClick(View v)


Can anyone see the problem?  It works, just not as I hoped.  Is there
any way this could be more efficient as well?

Other Threads

1. AudioRecord creates a stereo file instead of a mono file.

Yes its a bug, sounds like the WAV header is wrong. You'll have to
hack at that source to fix it..


2. Urgent Help: AudioTrack class ...Streaming Mode

8khz sample rate sends 8 samples per ms. If you bundle up 50ms worth
of samples in a packet (400 samples, 800 bytes) and send them the 50
ms lag is almost undetectable (unless you can hear the original too...
2 phones at the same time for example)


3. Display progress of xml parsing?

4. Listener on Spinner

5. Capturing all the Browser Events

6. HTC Incredible not seeing market apps with GL 2.0 min set on manifest?

7. Info gempa