【发布时间】:2015-01-21 18:59:55
【问题描述】:
我想用 CarList 作为 childList,这样 HashMap 是列表的一行,组字符串是表头。我怎样才能将它们组合在一起。我还需要一个适配器来使用这些。
以下代码是我目前所拥有的。
ArrayList<HashMap<String, String>> CarList;
static final String TAG_URLS = "urls";
static final String TAG_ID = "id";
static final String TAG_NAME = "name";
static final String TAG_PIC = "pic";
String group;
CarList = new ArrayList<HashMap<String, String>>();
List<Cars> cars = db.getAllCars();
String group = "Cars";
for (Cars cn : cars) {
HashMap<String, String> map = new HashMap<String, String>();
String id = String.valueOf(cn.getID());
String name = cn.getName();
String urls = cn.getUrls();
String pic = cn.getPic();
map.put(TAG_ID, id);
map.put(TAG_NAME, name);
map.put(TAG_URLS, urls);
map.put(TAG_PIC, pic);
CarList.add(map);
}
【问题讨论】:
-
你想要3个级别吗?
标签: android string arraylist expandablelistview expandablelistadapter