It depends on what type of audio you want to play... If you're playing
short WAV files, maybe you should look at AudioTrack instead of
MediaPlayer?  MediaPlayer has worked perfectly well for me with MP3s
though.  Maybe review the MediaPlayer State Diagram if you're having
trouble...



On Aug 26, 12:25 pm, ericmahlon <ericmah...@hotmail.com> wrote:
> In my class I have an OnTouchEvent and when a certain area is clicked,
> it will play a sound (Not sure if this is the best way to go about
> this?).  However I have been running into bugs using the MediaPlayer.
> Sound will double play and then eventually sound will stop
> completely.  I am wondering how to efficiently play 5 sounds.  The
> user will be clicking the screen in different areas and different
> sounds will be playing.  I have the attached code below but it only
> has the first area....say I add in another area how would I go about
> changing the media player to play a different sound.
>
> @Override
>     public boolean onTouchEvent(MotionEvent e)
>     {
>
>         x = e.getX();
>         y = e.getY();
>
>         if (x >= 232 && x<=287 && y>=117 && y<=157) {
>              //PLAY SOUND
>     }
>
>         return true;
>
> }
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to