0

By the following code I can load contact names and emails, but I want to get the picture path of that contact too, so that I can show that image on imageview on each listview item. Have seen few posts like this, but I am unable to understand how it can be achieved with my contacts query. My main doubt is PHOTO_ID returns long, how can I use that to get the path of the picture.

String[] PROJECTION = new String[] { ContactsContract.RawContacts._ID, 
                    ContactsContract.Contacts.DISPLAY_NAME,
                    ContactsContract.Contacts.PHOTO_ID,
                    ContactsContract.CommonDataKinds.Email.DATA, 
                    ContactsContract.CommonDataKinds.Photo.CONTACT_ID };
            String order = "CASE WHEN " 
                    + ContactsContract.Contacts.DISPLAY_NAME 
                    + " NOT LIKE '%@%' THEN 1 ELSE 2 END, " 
                    + ContactsContract.Contacts.DISPLAY_NAME 
                    + ", " 
                    + ContactsContract.CommonDataKinds.Email.DATA
                    + " COLLATE NOCASE";
            String filter = ContactsContract.CommonDataKinds.Email.DATA + " NOT LIKE ''";
            Cursor cur = cr.query(ContactsContract.CommonDataKinds.Email.CONTENT_URI, PROJECTION, filter, null, order);

Can someone please tell me how to load picture of each contact? Thanks in advance.

Community
  • 1
  • 1
Spike
  • 147
  • 3
  • 17
  • @Raghunandan The same reply from me too as that OP commented to you. Have you read the question? – Spike Jul 01 '13 at 12:14
  • @Raghunandan well, I clearly mentioned that I am able to get name, email etc., but I wanna get the image path of each contact. Your answer which is interlinked in that post fetches only the values that I am already able to get. Thanks though. – Spike Jul 01 '13 at 12:18

0 Answers0