On Wed, Dec 21, 2011 at 2:05 PM, kumar <kkvarm...@gmail.com> wrote:

> Hi,
>
> Thanks for your early reply Md.Fazla Rabbi.
>
> * I have noted your point, in my app  I am  also using same as this,  but
> here is  my requirement below*:
> 1. Once i click on a button, it should give me three different sounds one
> after the other?  I have three music files, which should be run one after
> the other as soon as the music of first complete, then second should start,
> once the second is completed then third should start, and complete. How to
> provide duration for each audio file?
>
> *Here the problem is: *
> In my app audio files are with different duration lengths.
> How can I find the duration length and play each audio file?
> If anyone knows soon for this, Please provide me.
>
>
I got your problem, you want to play audio files one after the other.

*Here the solution is: *

Firstly, play the first audio file.
Then call the setOnCompletionListener on MediaPlayer like this:

mp.setOnCompletionListener()           // called on completion of the
currently playing audio.

start second audio file here, and similarly the third one.


*Note*: if you are using single MediaPlayer (object), you must have to use
if...else condition in onCompletionListener to check the currently playing
file, and switch to the next file according to it.


With Regards
NSR

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