开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜