Tuesday 4 September 2012

android: Hasp Map With String Array Grouped by category in android?


ListView lv1 = (ListView) findViewById(R.id.elist);

ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
HashMap<String, String> map = new HashMap<String, String>();
for (int k = 0; k < rowe.length; k++) {
map = new HashMap<String, String>();
map.put("ENG", rowe[k]);
map.put("LNG", "English");
mylist.add(map);
}
for (int k = 0; k < rowt.length; k++) {
map = new HashMap<String, String>();
map.put("ENG", rowt[k]);
map.put("LNG", "Telugu");
mylist.add(map);
}
for (int k = 0; k < rowh.length; k++) {
map = new HashMap<String, String>();
map.put("ENG", rowh[k]);
map.put("LNG", "Hindi");
mylist.add(map);
}


SimpleAdapter mSchedule = new SimpleAdapter(this, mylist,
R.layout.langlistview, new String[] { "ENG",
"LNG" }, new int[] { R.id.langtext,
R.id.textlang});
lv1.setAdapter(mSchedule);


1 comment: