1
因此,我幾乎完成了我的項目,並且需要最後一點幫助按下隨機播放按鈕。當歌曲結束時,隨機按鈕停止應用程序
@Override
public void onCompletion(MediaPlayer mp1) {
try {
if(isRepeat == true) {
mp.start();
}
else if(isShuffle == true) {
mp.reset();
Random rand = new Random();
SONG_NUMBER = rand.nextInt((songs.size() - 1) - 0 + 1) + 0;
mp.setDataSource(SD_PATH + songs.get(SONG_NUMBER));
mp.start();
}
else
{
mp.reset();
SONG_NUMBER += 1;
mp.setDataSource(SD_PATH + songs.get(SONG_NUMBER));
mp.prepare();
mp.start();
}
play.setEnabled(false);
pause.setEnabled(true);
stop.setEnabled(true);
next.setEnabled(true);
prev.setEnabled(true);
replay.setEnabled(true);
shuffle.setEnabled(true);
}
catch(IOException e) {
Log.v(getString(R.string.app_name), e.getMessage());
}
}
當點擊洗牌按鈕,將其設置到isShuffle
但true
當歌曲結束,音樂播放器完全停止。任何人都可以幫助這個?
的logcat:
10-27 12:00:51.858: W/SignalStrength(724): getGsmLevel ro.show.3g.level.by.rscp = false
10-27 12:00:51.859: W/SignalStrength(566): getGsmLevel ro.show.3g.level.by.rscp = false
10-27 12:00:51.859: W/SignalStrength(671): getGsmLevel ro.show.3g.level.by.rscp = false
10-27 12:00:51.861: W/SignalStrength(671): getGsmLevel ro.show.3g.level.by.rscp = false
10-27 12:00:51.863: E/ActivityManager(566): Intent: Intent { act=android.intent.action.SIG_STR flg=0x10 (has extras) }mEnablePowerSaverManagerFunction:truesuperMode:false
10-27 12:00:56.979: W/SignalStrength(724): getGsmLevel ro.show.3g.level.by.rscp = false
10-27 12:00:56.980: W/SignalStrength(566): getGsmLevel ro.show.3g.level.by.rscp = false
10-27 12:00:56.981: W/SignalStrength(671): getGsmLevel ro.show.3g.level.by.rscp = false
10-27 12:00:56.983: W/SignalStrength(671): getGsmLevel ro.show.3g.level.by.rscp = false
10-27 12:00:56.988: E/ActivityManager(566): Intent: Intent { act=android.intent.action.SIG_STR flg=0x10 (has extras) }mEnablePowerSaverManagerFunction:truesuperMode:false
10-27 12:00:57.434: E/ActivityManager(566): Intent: Intent { act=android.intent.action.BATTERY_CHANGED flg=0x60000010 (has extras) }mEnablePowerSaverManagerFunction:truesuperMode:false
10-27 12:01:00.008: E/ActivityManager(566): Intent: Intent { act=android.intent.action.TIME_TICK flg=0x40000014 (has extras) }mEnablePowerSaverManagerFunction:truesuperMode:false
10-27 12:01:02.101: W/SignalStrength(724): getGsmLevel ro.show.3g.level.by.rscp = false
10-27 12:01:02.102: W/SignalStrength(566): getGsmLevel ro.show.3g.level.by.rscp = false
10-27 12:01:02.103: W/SignalStrength(671): getGsmLevel ro.show.3g.level.by.rscp = false
10-27 12:01:02.105: W/SignalStrength(671): getGsmLevel ro.show.3g.level.by.rscp = false
10-27 12:01:02.110: E/ActivityManager(566): Intent: Intent { act=android.intent.action.SIG_STR flg=0x10 (has extras) }mEnablePowerSaverManagerFunction:truesuperMode:false
你可以選擇更好的標題? – 2014-10-27 00:41:02
是更好嗎? – soul6942 2014-10-27 00:45:00
從logcat – Karakuri 2014-10-27 01:38:57