I am working on a game in Android and i wanted to add a sort of playlist of music. I have about 10 music files and i want to be able to play the second one when the first one has finished and so on. Is there anyway to do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use the Android Mediaplayer
and use an OnCompletionListener in which you send a message to a handler, from which you pass the next audiofile to the mediaplayer.
EDIT :
You do not really need to use a handler. Here is an example of how you could implement it.
Save your titles and a counter as member variables:
And this is how your onCompletion listener would look like: