ArrayList<Object> list集合取值
ArrayList<Object>list=newArrayList<Object>();//短信通话软件记录集合ArrayList<HashMap<String,Obj...
ArrayList<Object> list = new ArrayList<Object>();// 短信通话软件记录集合
ArrayList<HashMap<String, Object>> smsList = new ArrayList<HashMap<String, Object>>();//短信
ArrayList<HashMap<String, Object>> callList = new ArrayList<HashMap<String, Object>>();//通话
ArrayList<HashMap<String, Object>> inList = new ArrayList<HashMap<String, Object>>();//软件
JSONArray jsonArray1 = new JSONArray(data);
for (int i = 0; i < jsonArray1.length(); i++) {
JSONObject jsonObject = jsonArray1.getJSONObject(i);
// 初始化map数组对象
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("data", jsonObject.getString("data"));
map.put("message", jsonObject.getString("message"));
map.put("number", jsonObject.getString("number"));
map.put("type", jsonObject.getString("type"));
map.put("menutype", jsonObject.getString("menutype"));
switch (Integer.parseInt(jsonObject.getString("menutype").toString())) {
case 1: // 短信
smsList.add(map);
break;
case 2://通话
callList.add(map);
break;
case 3://软件
inList.add(map);
break;
}
}
list.add(callList);
list.add(smsList);
list.add(inList);
请高手指教如何在适配器BaseExpandableListAdapter方法getChildView()区分它们????
public View getChildView(int arg0, int arg1, boolean arg2, View arg3,
ViewGroup arg4) {
} 展开
ArrayList<HashMap<String, Object>> smsList = new ArrayList<HashMap<String, Object>>();//短信
ArrayList<HashMap<String, Object>> callList = new ArrayList<HashMap<String, Object>>();//通话
ArrayList<HashMap<String, Object>> inList = new ArrayList<HashMap<String, Object>>();//软件
JSONArray jsonArray1 = new JSONArray(data);
for (int i = 0; i < jsonArray1.length(); i++) {
JSONObject jsonObject = jsonArray1.getJSONObject(i);
// 初始化map数组对象
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("data", jsonObject.getString("data"));
map.put("message", jsonObject.getString("message"));
map.put("number", jsonObject.getString("number"));
map.put("type", jsonObject.getString("type"));
map.put("menutype", jsonObject.getString("menutype"));
switch (Integer.parseInt(jsonObject.getString("menutype").toString())) {
case 1: // 短信
smsList.add(map);
break;
case 2://通话
callList.add(map);
break;
case 3://软件
inList.add(map);
break;
}
}
list.add(callList);
list.add(smsList);
list.add(inList);
请高手指教如何在适配器BaseExpandableListAdapter方法getChildView()区分它们????
public View getChildView(int arg0, int arg1, boolean arg2, View arg3,
ViewGroup arg4) {
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询