Drop down menu 代码名1:查询到字符串选择器

Drop down menu 代码名1:查询到字符串选择器,drop-down-menu,codenameone,Drop Down Menu,Codenameone,我想填充一个选择器(接受字符串)。这将把select查询的结果转换成字符串数组,这样我就可以将它们设置为选择器的字符串。用户应该能够从选择器中的项目列表中进行选择 我将非常感谢您对如何实施此计划的任何帮助和建议。基于: cur=db.executeQuery(query.getText()); 布尔next=cur.next(); ArrayList strs=新的ArrayList(); while(下一个){ 行currentRow=cur.getRow(); String[]current

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

我将非常感谢您对如何实施此计划的任何帮助和建议。

基于:

cur=db.executeQuery(query.getText());
布尔next=cur.next();
ArrayList strs=新的ArrayList();
while(下一个){
行currentRow=cur.getRow();
String[]currentRowArray=新字符串[列];
添加(currentRow.getString(“columnName”);
}
字符串[]数据=新字符串[strs.size()];
标准toArray(数据);
选择器固定管柱(STR);
基于:

cur=db.executeQuery(query.getText());
布尔next=cur.next();
ArrayList strs=新的ArrayList();
while(下一个){
行currentRow=cur.getRow();
String[]currentRowArray=新字符串[列];
添加(currentRow.getString(“columnName”);
}
字符串[]数据=新字符串[strs.size()];
标准toArray(数据);
选择器固定管柱(STR);
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);