如何在列表视图中显示来自 JSON 的图像和字符串文本?
// new HashMap
HashMap<String, String> hashMap = new HashMap<String, String>();
String imageName = c.getString("avater");
URL url1 = new URL(imageName);
HttpURLConnection connection = (HttpURLConnection) url1.openConnection();
InputStream is = connection.getInputStream();
Bitmap img = BitmapFactory.decodeStream(is);
//updating listview with the parsed items
ListAdapter adapter = new SimpleAdapter(
Inboxtest.this,
entryList,
R.layout.inboxlist,
new String[] { TAG_QUERY, TAG_RESULT, timesent, icon },
new int[] { R.id.textView1, R.id.textView3, R.id.textView2, R.id.textView4 }
);
setListAdapter(adapter);
我需要将图像放在此列表中。