3
我做了以下操作,以獲取顯示在watchVideo窗體中的列表中所選項目的json值...但是通過任何方式我都可以獲取下一個列表項的值太讓我可以設置watchVideo形式下一個按鈕,直接播放下一個視頻太...選擇問題(列表/多重列表)codenameone
findYoutubeMultiList(f).setModel(new com.codename1.ui.list.DefaultListModel(mData));
findYoutubeMultiList(f).addActionListener((e) -> {
selection = (Map<String, String>) findYoutubeMultiList(f).getSelectedItem();
indexSelection = findYoutubeMultiList(f).getSelectedIndex();
**//i can get the index of selected item by above indexSelection but how to get the value of the incremented index??**
showForm("WatchVideo", null);
});
編輯:
for (int i = 0; i < response.size(); i++) {
Hashtable hm = (Hashtable) response.get(i);
Hashtable snippet = (Hashtable) hm.get("snippet");
HashMap<String, Object> m = new HashMap<String, Object>();
videoResource = (Hashtable) snippet.get("resourceId");
videoId = videoResource.get("videoId").toString();
m.put("video", videoId);
mData.add(m);
}
WatchVideo形式:
protected void beforeWatchVideo(Form f) {
for (int i = 0; i < mData.size(); i++) {
//how to get the position of selection and more
importantly how to get the values of incremented index
}
hello Diamond ...我不明白你的意思源的多重列表..我已經更新了這個問題..你是否指我編輯部分中提到的部分?? – beck
確保您的mData是靜態的,並且可以通過WatchVideo表單訪問。在WatchVideo上,通過mData循環並找到**選擇**的位置。現在增加位置並將選擇的值設置爲新值並播放。 – Diamond
對不起鑽石......你能更精確嗎?是的,我可以從watchVideo窗體訪問mData。 for(int i = 0; i
beck