如何在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);
我需要把圖像放在這個列表中。
我的博客文章我也行文本和圖像,但我不能老是顯示圖像在此行中 –
分享你行的XML。運行時是否有錯誤? –