Codename One:查询字符串选择器

时间:2016-03-15 13:02:11

标签: drop-down-menu codenameone

我想填充一个选择器(接受字符串)。这应该将select查询的结果转换为字符串数组,以便我可以将它们设置为选择器的字符串。用户应该能够从选择器中的项目列表中进行选择。

我很感激有关如何实现这一点的任何帮助和建议。

1 个答案:

答案 0 :(得分:0)

基于this

cur = db.executeQuery(query.getText());
boolean next = cur.next();
ArrayList<String> strs = new ArrayList<>();
while(next) {
   Row currentRow = cur.getRow();
   String[] currentRowArray = new String[columns];
   strs.add(currentRow.getString("columnName"));   
}

String[] data = new String[strs.size()];
strs.toArray(data);
picker.setStrings(strs);
相关问题