@Override
public
void
onCreate(Bundle savedInstanceState) {
super
.onCreate(savedInstanceState);
setContentView(R.layout.listmain);
SimpleAdapter adapter =
new
SimpleAdapter(
this
,getData(),R.layout.maplist,
new
String[]{
"name"
,
"kongwei"
,
"code"
,
"addr"
},
new
int
[]{R.id.name,R.id.kongwei,R.id.code,R.id.addr});
setListAdapter(adapter);
};
private
List<Map<String, Object>> getData() {
List<Map<String, Object>> list =
new
ArrayList<Map<String, Object>>();
List<Parking_Info> mylist=(List<Parking_Info>)getIntent().getSerializableExtra(
"list"
);
for
(
int
i=
0
;i<mylist.size();i++)
{
Map<String, Object> map =
new
HashMap<String, Object>();
map.put(
"name"
,mylist.get(i).getPrk_name());
map.put(
"kongwei"
,
"空位:"
+mylist.get(i).getKongwei());
map.put(
"code"
,
"收费:"
+ mylist.get(i).getCode());
map.put(
"addr"
,
"地址:"
+mylist.get(i).getPrk_addr());
list.add(map);
}
return
list;
}
http://www.cnblogs.com/userbibi/archive/2012/03/29/2423202.html