尝试做但不能在移动设备上从外部循环我的音乐 我不知道为什么不在setOnCompletionListener方法上查看我的代码
抱歉,我的英语不好......谢谢你
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_audio_effects);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
updatePlaylist();
Uri video = Uri.parse(Environment.getExternalStorageDirectory().getPath() + "/Music/" + songs.get(0));
mMediaPlayer = MediaPlayer.create(this, video);
mMediaPlayer.start();
mEqualizer = new Equalizer(0, mMediaPlayer.getAudioSessionId());
mEqualizer.setEnabled(true);
setupVisualizerFxAndUI();//อันนี้แสดง คลื่นเสียง
setupEqualizerFxAndUI();
mVisualizer.setEnabled(true);//อันนี้แสดง คลื่นเสียง
mMediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mediaPlayer) {
mVisualizer.setEnabled(false);//อันนี้แสดง คลื่นเสียง
i++;
mMediaPlayer.reset();
if (i < songs.size()) {
try {
Uri video = Uri.parse(Environment.getExternalStorageDirectory().getPath() + "/Music/" + songs.get(i));
if (video != null) {
mMediaPlayer = MediaPlayer.create(AudioFxActivity.this, video);
// mEqualizer = new Equalizer(0, mMediaPlayer.getAudioSessionId());
mMediaPlayer.start();
}
} catch (Exception ex) {
// report a crash
Log.v(getString(R.string.app_name), ex.getMessage());
}
} else {
// done with media player
mMediaPlayer.release();
mMediaPlayer = null;
}
}
});mMediaPlayer.start();
}
&#13;