我正在尝试在我的惰性适配器上显示联系人照片。我设法将 Photo_ID 放入 arrayList 我不知道如何在图像视图上显示它。
这是我所做的:
while (cur.moveToNext())
{
String Sid = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID));
String name = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
String photo = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.PHOTO_ID));
Log.e("Photo",""+photo);
HashMap<String, String> map = new HashMap<String, String>();
map.put("name", name);
map.put("id", Sid);
map.put("photo",photo);
DetailsList.add( map);
}
}
cur.close();
adapter = new ContactNamesAdapter(this, DataList);
// updating listview
cl.setAdapter(adapter);
}
}
记录照片的值时:我得到 photo_ID#。我调用的适配器类显示如下名称:
public View getView(int position, View convertView, ViewGroup parent)
{
View vi=convertView;
if(convertView==null)
vi = inflater.inflate(R.layout.contacts_names_row, null);
TextView name = (TextView)vi.findViewById(R.id.name);
name.setText(data.get(position).get("name"));
return vi;
}
}
我卡在适配器端显示带照片的 ID?