I am trying to create a 4 column listview using arrayAdapter, and add values manually in the 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);
}
My problem is i want to add list items dynamically from a two dimensional array How it is possible??? the item count have the same size of the string array?? ie; insted of
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");
i want to display
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]");
in a for loop also my doubut is how to create hashmap dynamically