我有一張照片Uri和我想要在ListView中顯示它,我該怎麼做? 這裏是我的代碼如何在Uri中顯示ListView中的圖像
Uri img = getImgByContactId(Long id);
map.put("imgcontact", ???? img ??????);
map.put("date", "20/2010");
map.put("duration", String.valueOf(duration));
map.put("type", finalTypeImg);
SimpleAdapter mSchedule = new SimpleAdapter (this.getBaseContext(), listItem, R.layout.calllogtemplate,
new String[] {"num", "name", "imgcontact", "date", "duration", "type"},
new int[] {R.id.num, R.id.name, R.id.imgcontact, R.id.date, R.id.duration, R.id.typecall});
ListView maListViewPerso = (ListView) findViewById(android.R.id.list);
maListViewPerso.setAdapter(mSchedule);
感謝
編寫自己的適配器,它擴展了ArrayAdapter,然後在getView()中自己處理圖像,並使用你的uri將其設置爲imageview。 – Blundell 2012-01-28 00:23:56