List
private List<HashMap<String, Object>> getData(){
List<HashMap<String, Object>> datas = new ArrayList<>();
// 给list增加一条数据
HashMap<String, Object> data = new HashMap<>();
// Map映射添加数据
data.put("title1", "蔡志坤");
data.put("title2", "25");
data.put("title3", "ffczk86@gmail.com");
data.put("title4", "厦门市");
// 将这个map放到list中
datas.add(data);
data = new HashMap<>();
data.put("title1", "李杰华");
data.put("title2", "25");
data.put("title3", "aa@bb.com");
data.put("title4", "漳州市");
datas.add(data);
data = new HashMap<>();
data.put("title1", "张亮");
data.put("title2", "25");
data.put("title3", "cc@gmail.com");
data.put("title4", "厦门市");
datas.add(data);
data = new HashMap<>();
data.put("title1", "刘玄德");
data.put("title2", "25");
data.put("title3", "ffczk86@gmail.com");
data.put("title4", "福州市");
datas.add(data);
return datas;
}
}
CusomAdapter
public class CustomAdapter extends BaseAdapter {
private List dates; private Context context;
public CustomAdapter(Context context, List dates) {
this.dates = dates; this.context = context;
}