2016-03-15 51 views
1

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

我将不胜感激关于如何实现这一点的任何帮助和建议。

回答

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);