Tuesday, December 20, 2011

Re: [android-developers] Re: Regarding play audio files using SoundPool class

Hi Verma,
I have developed a app which holds some audio files(50 sound files). For my app  i have used MediaPlayer Object which play one sound file at a time. So for these 50 sound files i have stored sound files in res/raw folder. Then in my code i use an array which holds the id of the sounds. After that i pass one sound file at a time to MediaPlayer Object using the index number of the array.

This is something like this:

int [] sounds=new int[] {R.raw.sound1, R.raw.sound2, R.raw.sound3};

MediaPlayer mp=new MediaPlayer( MyActivity.this, sounds[i] );///
Where i is the index no. of the sounds array
mp.start();


Hope this will helpful for you.

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment