我已经按照以下步骤获取了在watchVideo表单中显示的列表中所选项的json值...但是是否有任何方法可以获取下一个列表项的值,以便我可以在watchVideo表单中设置下一个按钮并直接播放下一个视频...
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);
}
视频观看表单:
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
}