我正在尝试使用 arrayAdapter 创建一个 4 列列表视图,并在 populateList() 中手动添加值
private void populateList()
{
list = new ArrayList<HashMap<String,String>>();
HashMap<String,String> temp1 = new HashMap<String,String>();
temp1.put(FIRST_COLUMN,"Diaries");
temp1.put(SECOND_COLUMN, "Products");
temp1.put(THIRD_COLUMN, "Rs. 400");
temp1.put(FOURTH_COLUMN, "ggg Unit");
list.add(temp1);
HashMap<String,String> temp2 = new HashMap<String,String>();
temp2.put(FIRST_COLUMN,"Note Books");
temp2.put(SECOND_COLUMN, "Products");
temp2.put(THIRD_COLUMN, "Rs. 600");
temp2.put(FOURTH_COLUMN, "hhh Unit");
list.add(temp2);
}
我的问题是我想从二维数组动态添加列表项怎么可能???项目计数与字符串数组的大小相同??IE; 安装的
HashMap<String,String> temp1 = new HashMap<String,String>();
temp1.put(FIRST_COLUMN,"Diaries");
temp1.put(SECOND_COLUMN, "Products");
temp1.put(THIRD_COLUMN, "Rs. 400");
temp1.put(FOURTH_COLUMN, "ggg Unit");
我想显示
temp1.put(FIRST_COLUMN,"myArry[i][j]");
temp1.put(SECOND_COLUMN, "myArry[i][j]");
temp1.put(THIRD_COLUMN, "myArry[i][j]");
temp1.put(FOURTH_COLUMN, "myArry[i][j]");
在 for 循环中, 我的 doubut 也是如何动态创建 hashmap