私はプロジェクトに取り組んでいます。これにより、jsonを介してリストにデータが入力される可能性があります。http://10.0.2.2/mobile_version/get_supplier_pro_list.phpからのデータを解析しましたが、画像ではなくテキストが表示されています。
// Hashmap for ListView
ArrayList<HashMap<String, String>> contactList = new ArrayList<HashMap<String, String>>();
// Creating JSON Parser instance
JSONParser jParser = new JSONParser();
// getting JSON string from URL
JSONObject json = jParser.getJSONFromUrl(url);
try {
// Getting Array of Contacts
sup_pd_list = json.getJSONArray(TAG_SUPPLIERS);
// looping through All Contacts
for (int i = 0; i < sup_pd_list.length(); i++) {
JSONObject c = sup_pd_list.getJSONObject(i);
// Storing each json item in variable
String suply_id = c.getString(TAG_ID);
String pd_name = c.getString(TAG_PRO_NAME);
String pd_price = c.getString(TAG_PRO_PRICE);
String pd_thumbnail = c.getString(TAG_PRO_THUMBNAIL);
// creating new HashMap
HashMap<String, String> map = new HashMap<String, String>();
// adding each child node to HashMap key => value
map.put(TAG_ID, suply_id);
map.put(TAG_PRO_NAME, pd_name);
map.put(TAG_PRO_PRICE, pd_price);
map.put(TAG_PRO_THUMBNAIL, pd_thumbnail);
// adding HashList to ArrayList
contactList.add(map);
}
} catch (JSONException e) {
e.printStackTrace();
}
/**
* Updating parsed JSON data into ListView
* */
ListAdapter adapter = new SimpleAdapter(this, contactList,
R.layout.single_list_item, new String[] { TAG_PRO_NAME,
TAG_PRO_PRICE, TAG_PRO_THUMBNAIL}, new int[] {
R.id.pd_name, R.id.pd_price , R.id.pd_thumbnail });
setListAdapter(adapter);
}
そしてlogcatでは、それは私を示しています
12-14 03:47:12.743: I/System.out(314): resolveUri failed on bad bitmap uri: fceacd5431438f9d93fb4f885a3b2990.png
12-14 03:47:12.762: I/System.out(314): resolveUri failed on bad bitmap uri: d254d82762217f8e1005013c8926f53e.jpg
そして、構文解析を通じて、私が得るものは
{"suppliers":[{"suply_id":null,"pd_name":"car","pd_price":"200000.00","pd_thumbnail":"fceacd5431438f9d93fb4f885a3b2990.png"}],"success":1}
ヘルプが必要です。前もって感謝します。