【发布时间】:2018-08-06 21:43:10
【问题描述】:
我正在实现一个显示类似结果的搜索结果页面。我有一个哈希映射数组列表(有 50 个映射,每个映射有 12 个值)。我想在结果页面的卡片视图中显示每个地图。我尝试为此使用回收站视图。但无法将我的想法包裹起来。 我已经遍历了堆栈溢出中的所有线程,但我找不到任何东西。
ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String,String>>();
nodes = docc.getElementsByTagName("Table");
int k = nodes.getLength();
for (int i = 0; i < k; i++) {
Element e = (Element) nodes.item(i);
HashMap<String, String> map = new HashMap<String, String>();
patid = getValue(e, "iPat_id");
patname = getValue(e, "cPat_Name");
patAge = getValue(e, "iAge");
cMaritalSt = getValue(e, "cMarital_St");
OpRegNo = getValue(e, "iReg_No");
Doc_Id = getValue(e, "iDoc_id");
Dept_Id = getValue(e, "iDept_id");
DocName = getValue(e, "cDocName");
PatAddress = getValue(e, "PatAddress");
mobileno = getValue(e, "cMobile");
patdob = getValue(e, "dDob");
iOP_Reg_No = getValue(e, "iOP_Reg_No");
map.put("iPat_id", patid);
map.put("cPat_Name", patname);
map.put("iAge", patAge);
map.put("cMarital_St", cMaritalSt);
map.put("iReg_No", OpRegNo);
map.put("iDoc_id", Doc_Id);
map.put("iDept_id", Dept_Id);
map.put("cDocName", DocName);
map.put("PatAddress", PatAddress);
map.put("cMobile", mobileno);
map.put("dDob", patdob);
map.put("iOP_Reg_No", iOP_Reg_No);
mylist.add(map);
}
这是我得到的 ArrayList。请给我一个示例,说明如何为此 Arraylist 设置回收器适配器。
【问题讨论】:
-
显示您的代码.. 您尝试在 recyclerView 中显示什么
-
您实际上想做什么?过滤还是只显示数据?
-
我需要将地图中的 patname, patAge, DocName 显示为回收站视图中的卡片视图
-
我只想显示数据@RushabhShah
-
你需要有一个自定义的 recyclerview 适配器并将你的 myList 传递给你的 RecyclerView 适配器并从适配器中的位置按位置从列表中获取地图
标签: android arraylist hashmap android-recyclerview