我認爲你所需要做的就是致電videoView.setVideoPath(next_file_path)
,然後致電videoView.start()
。如果沒有更多視頻,請致電videoView.stopPlayback()
。
這裏的東西可能工作:
@Override
public void onClick(DialogInterface dialog, int which) {
if (arg1 == 0) {
Intent intentInfo = new Intent(ListViewActivity.this, DialogBox.class);
// Retrieve the path names of all videos from the top to the
// selected item (inclusive).
arrayPath = new String[selectedPosition+1];
for (int i = 0; i <= selectedPosition; ++i) {
arrayPath[i] = videoItems.get(i).absolutePath;
}
VideoInfo info = videoItems.get(selectedPosition);
intentInfo.putExtra("fileName", info.name);
intentInfo.putExtra("fileSize", info.size);
intentInfo.putExtra("absolutePath", info.absolutePath);
intentInfo.putExtra("arrayPath", arrayPath);
startActivity(intentInfo);
}
else
{
deleteFile();
}
}
此經過的路徑名的數組的對話框活動(你還沒有發佈)。如果用戶選擇播放所有視頻,則應能夠檢索arrayPath
並將其傳遞到VideoView活動。
@Ted Hopp然後我應該如何獲得(next_file_path)在列表視圖讓它不斷地在列表視圖條目中找到新的視頻? – Vivian 2011-05-20 03:35:58
現在你把一個視頻路徑放在'videoPath'中。我建議你把你想播放的整個視頻陣列。 (您可以像一個字符串一樣容易地將String數組放入一個額外的意圖。)這樣ViewVideo活動將知道所有需要播放的視頻。您可以簡單地保留當前正在播放的索引,並在完成時繼續播放下一個視頻文件路徑。 – 2011-05-20 07:00:15
@Ted Hopp我已經更新了我的答案,但是您所指的「索引」部分我真的不知道如何實現我的代碼? – Vivian 2011-05-20 15:39:25