krishnendra
krishnendra

Reputation: 99

How to write code for Next and Previous Buttons in Media controler in android

Hello Friends i am using Media controler in my code and i am including below code but can any body tell me what should i write inside this methods so i can play next and previous songs in media player .

        mediaController.setPrevNextListeners(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                //next button clicked

                  myVideoView.setVideoPath(filename);
              }
            }, new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                //previous button clicked
              }
            });

Upvotes: 0

Views: 1362

Answers (1)

5hssba
5hssba

Reputation: 8079

You will have an array list like this..

 ArrayList<String> filename = new ArrayList<String>();

with all the files you want to play..

maintain an index of currently being played filename... and you can move to next and previous filenames using that index..

Upvotes: 1

Related Questions