我在ListView
中得到無效值。我的代碼如下。從ArrayList得到無效值<HashMap <String,String >>
final ArrayList<HashMap<String, String>> placesListItems = new ArrayList<HashMap<String, String>>();
runOnUiThread(new Runnable() {
public void run() {
try {
HashMap<String, String> map = new HashMap<String, String>();
for (int i = 0; i < dealList.size(); i++) {
map.put(DealItem.DEAL_ID, dealList.get(i).deal_id);
map.put(DealItem.DEAL_NAME, dealList.get(i).deal_name);
System.out.println("DEAL NAME = "+dealList.get(i).deal_name);
placesListItems.add(map);
}
new PlacesMapActivity(SinglePlaceActivity.this, lon, lat, name, add);
ListView lv = (ListView) findViewById(R.id.listView);
simpleAdapter = new SimpleAdapter(SinglePlaceActivity.this, placesListItems, R.layout.list_item_deal, new String[] {
DealItem.DEAL_ID, DealItem.DEAL_NAME }, new int[] { R.id.reference, R.id.name });
lv.setAdapter(simpleAdapter);
當我運行這段代碼我得到的答案是這樣
10-03 18:37:29.429: I/System.out(3957): DEAL NAME = Sinbad Cafe
10-03 18:37:52.369: I/System.out(3957): DEAL NAME = Coffee,Tea, Hot Milk
10-03 18:37:55.189: I/System.out(3957): DEAL NAME = Httpss
但我不明白爲什麼我在ListView
得到一個無效的值象下面這樣:
Httpss
Httpss
Httpss
@Shark:simpleAdapter是* *製成的地圖列表。這太神奇了? – njzk2
哎呦,我的壞。認爲它更像BaseAdapter ... – Shark