Playing audio files continously from a listview, without user click on the listitem
I have a list of audio files in a directory in sdcard. I have derived the file开发者_开发技巧s in a listview, now I want to play the files continuously, without user click on the listitem. Any suggestion please
mp.setOnCompletionListener(new OnCompletionListener() {
public void onCompletion(MediaPlayer arg0) {
if (currentIx < playListLength - 1) {
currentIx++;
mp.reset();
// Change Current Song here using the set data source method and whatever else must change
mp.start();
}
}
});
when ever a audio is playing callbacks are automatically called. if the file completely played OnCompletionListener call back is called.you can again start the next file in that method.
To play songs continuously Have a look on the following URL
http://coderzheaven.com/index.php/2011/02/play-all-songs-from-your-raw-directory-in-android-continuously/
Thanks Deepak
精彩评论