我想将图像添加到列表视图中,我该怎么做?名称和类型显示正确。目前卡在这里。
.//other codes
.
.
try{
JSONArray arr = new JSONArray(res);
for(int i=0;i<arr.length();i++){
HashMap<String, String> map = new HashMap<String, String>();
JSONObject e = arr.getJSONObject(i);
map.put("placeID", ""+ e.getString("placeID"));
map.put("placeName",""+ e.getString("placeName"));
map.put("placeType", ""+ e.getString("placeType"));
map.put("image", R.drawable.ball_green);
mylist.add(map);
}
}catch(JSONException e) {
Log.e("log_tag", "Error parsing data "+e.toString());
}
ListAdapter adapter = new SimpleAdapter(this, mylist , R.layout.places,
new String[] { "placeName", "placeType" },
new int[] { R.id.placeName, R.id.placeType });
.
.
.//other codes
我想要适当的图像,例如: