java如何分解列表<List<String>>行
所以我有一个代码,其中变量var1、var2和var3指向List<String> temp
。每次点击一个按钮,另一批变量将转到函数末尾的temp
和temp
转到List<List<String>> rows
。请注意,我可以按任意次数单击该按钮,进程temp.add(var1); temp.add(var2); ... rows.add(temp);
将运行
现在,我想分解rows
并将temp
的所有数据保存到我的数据库中
以下是我代码的一部分:
ArrayList<String> temp = new ArrayList<String>();
temp.add(itemnameCol);
temp.add(itempriceCol+"");
temp.add(dialogVar+"");
t2Rows.add(temp);
这里是insert方法
public void addItem(String itemIn, String itemProd, String itemQuan){
cv.clear();
cv.put(INVOICE_NUM_ITEM,itemIn);
cv.put(PRODUCT_ID_ITEM,itemProd);
cv.put(PRODUCT_QUANTITY_ITEM,itemQuan);
dbw.insertOrThrow(TABLE_NAME_ITEM, null, cv);
}
# 1 楼答案
尝试使用for循环。试试这个