How To Add Different Child Lists For Different Parents Lists In Expandablelistview For Android?
I'm using an ExpandableListView to get an expandable list. I have 3 expandable 'parent' lists: Price, Details, Notes. I want to be able to add unique child lists for each parent li
Solution 1:
Your createChildList
needs to return a List<ArrayList<HashMap<String, String>>>
.
Your createChildList
should look something like this:
privateList<ArrayList<HashMap<String, String>>> createChildList(int maxValue) {
ArrayList<ArrayList<HashMap<String, String>>> groupList =
new ArrayList<ArrayList<HashMap<String, String>>>();
for (int i =0; i <= maxValue; i++) {
ArrayList<HashMap<String, String>> childList =
new ArrayList<HashMap<String, String>>();
for (int j =0; j <= maxValue; j++) {
HashMap<String, String> map = new HashMap<String, String>();
map.put("Sub Item", "test: "+String.valueOf(j));
childList.add(map);
}
groupList.add(childList);
}
return groupList;
}
Let me know if that works.
Post a Comment for "How To Add Different Child Lists For Different Parents Lists In Expandablelistview For Android?"