Пример #1
0
  private void play() {
    if (playStatus == 0) {
      Map<String, String> map = DataUtils.getMusicMap(musicIndex);
      String path = map.get("path");
      mediaPlayer = MediaPlayer.create(getApplicationContext(), Uri.parse(path));
      mediaPlayer.start();
      playStatus = 1;
    } else if (playStatus == 2) {
      playStatus = 1;
      mediaPlayer.start();
    } else {

    }

    mediaPlayer.setOnCompletionListener(
        new OnCompletionListener() {

          @Override
          public void onCompletion(MediaPlayer mp) {
            // TODO Auto-generated method stub
            PlayNext();
          }
        });
  }
Пример #2
0
 public static void preIndex() {
   musicIndex = musicIndex > 0 ? musicIndex - 1 : DataUtils.getList().size() - 1;
 }
Пример #3
0
 public static void nextIndex() {
   musicIndex = musicIndex < DataUtils.getList().size() - 1 ? musicIndex + 1 : 0;
 }