一个关于android的小问题,ArrayList listItem=new ArrayList();\x05\x05\x05HashMap map=new HashMap();\x05\x05\x05while(cursor.moveToNext()) {\x05\x05\x05\x05map=new HashMap();\x05\x05\x05\x05map.put("NAME",cursor.getString(0));\x05\x05\x05\x05map

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/05 16:46:41
一个关于android的小问题,ArrayList listItem=new ArrayList();\x05\x05\x05HashMap map=new HashMap();\x05\x05\x05while(cursor.moveToNext()) {\x05\x05\x05\x05map=new HashMap();\x05\x05\x05\x05map.put(

一个关于android的小问题,ArrayList listItem=new ArrayList();\x05\x05\x05HashMap map=new HashMap();\x05\x05\x05while(cursor.moveToNext()) {\x05\x05\x05\x05map=new HashMap();\x05\x05\x05\x05map.put("NAME",cursor.getString(0));\x05\x05\x05\x05map
一个关于android的小问题,
ArrayList listItem=new ArrayList();
\x05\x05\x05HashMap map=new HashMap();
\x05\x05\x05while(cursor.moveToNext()) {
\x05\x05\x05\x05map=new HashMap();
\x05\x05\x05\x05map.put("NAME",cursor.getString(0));
\x05\x05\x05\x05map.put("ADDRESS_LINE",cursor.getString(2));
\x05\x05\x05\x05map.put("VISITED",cursor.getString(3));
\x05\x05\x05\x05map.put("_id",cursor.getString(1));
\x05\x05\x05\x05listItem.add(map);
\x05\x05\x05}
问题是怎么把数据显示到listview上啊!

一个关于android的小问题,ArrayList listItem=new ArrayList();\x05\x05\x05HashMap map=new HashMap();\x05\x05\x05while(cursor.moveToNext()) {\x05\x05\x05\x05map=new HashMap();\x05\x05\x05\x05map.put("NAME",cursor.getString(0));\x05\x05\x05\x05map

根据下面的示例代码即可,这是取值,在ListView中显示只需要传递下值,或者是你直接赋值.

HashMap<String,Object>  d=new HashMap<String,Object>();
d.put("NAME", "XXXX");
ArrayList<HashMap<String,Object>> listItem=new ArrayList<HashMap<String,Object>>();
listItem.add(d);
int size=listItem.size();
HashMap<String,Object> map=null;
for(int i=0;i<size;i++){
map=listItem.get(i);
String Name=map.get("NAME").toString();
System.out.println(Name);
}