1

I need to get only those contacts which do have email-id associated with it. I need to get all details for above contacts. I did a hard R&D over internet but didn't get any luck. Please don't make it duplicate.

I got following link:

Get contacts with email id

How to get contact email id?

But Couldn't get any help.

Please Help!

Community
  • 1
  • 1
Harish Godara
  • 2,388
  • 1
  • 14
  • 28
  • Why exactly were those two links of no help? – Ishita Sinha Aug 10 '16 at 06:34
  • @IshitaSinha as I mentioned I need to get only those contacts which have email-id, both above links are for getting all contacts and retrieve their email-id, I hope you got it now. – Harish Godara Aug 10 '16 at 07:03
  • Check if the code in [this question](http://stackoverflow.com/questions/10117049/get-only-email-address-from-contact-list-android) helps? – Ishita Sinha Aug 10 '16 at 07:22
  • @IshitaSinha Earlier I tried this as well however as I mentioned I need all information (ie name, phone no, address etc) related to that contact which is associated with email-id. Thanks for your help :) – Harish Godara Aug 10 '16 at 07:47
  • I thought you needed to be pointed in the right direction, not code. You could parse a raw query with `"SELECT * FROM " + ContactsContract.Data.CONTENT_URI + " WHERE " + ContactsContract.CommonDataKinds.Email.ADDRESS + "IS NOT NULL"` in combination with the suggestions in those questions. – Ishita Sinha Aug 10 '16 at 10:43
  • @IshitaSinha the following query will throw 'no such column' exception "SELECT * FROM " + ContactsContract.Data.CONTENT_URI + " WHERE " + ContactsContract.CommonDataKinds.Email.ADDRESS + "IS NOT NULL" as ContactsContract.CommonDataKinds.Email.ADDRESS is not belongs to Data table. Thanks for your help! – Harish Godara Aug 10 '16 at 12:48
  • Try `ContactsContract.CommonDataKinds.Email.DATA` instead of `ADDRESS`? – Ishita Sinha Aug 10 '16 at 12:50

0 Answers0