I am trying to display contact photo on my lazy adapter. I managed to get the Photo_ID put them into an arrayList I am not sure how to display it on image view.
Here is what I done:
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);
}
}
When log the value of photo: I get the photo_ID#. The adapter Class that I called shows the name like this:
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;
}
}
I am stuck on displaying the photo ID on the adapter side?