Questions tagged [contactscontract]

Android's Contacts API is defined in the android.provider.ContactsContract and related classes.

The Android platform provides a Contacts API for managing and integrating contacts from multiple accounts and from other data sources.

To handle overlapping data from multiple sources, the contacts content provider aggregates similar contacts and presents them to users as a single entity.

ContactsContract defines an extensible database of contact-related information. Contact information is stored in a three-tier data model: Contacts, Raw Contacts and Data.

More information can be found in the documentation for the ContactsContract class.

554 questions
53
votes
5 answers

Android: Retrieve contact name from phone number

I would like to retrieve the name of a contact associated with an incoming telephone number. As I process the incoming number in the broascastreceiver having a String with the name of the incoming caller would help my project greatly. I would think…
Noah Seidman
  • 4,109
  • 5
  • 23
  • 28
50
votes
3 answers

Android contacts Display Name and Phone Number(s) in single database query?

I'm trying to obtain a list of contacts from the native database with their Display Name and Phone Number (any or all). There are many methods for obtaining this information with several queries to the phone's database, but this introduces…
Derek
  • 1,562
  • 1
  • 13
  • 25
43
votes
9 answers

How do I load a contact Photo?

I'm having trouble loading a photo for a contact in Android. I've googled for an answer, but so far have come up empty. Does anyone have an example of querying for a Contact, then loading the Photo? So, given a contactUri which comes from an…
PaulH
  • 618
  • 1
  • 10
  • 12
36
votes
2 answers

get contact info from android contact picker

I'm trying to call the contact picker, get the persons name, phone and e-mail into strings and send them to another activity using an intent. So far this works: Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); …
ng93
  • 1,530
  • 5
  • 22
  • 39
31
votes
4 answers

How do I make my Android ContentObserver for ContactsContract detect a added, updated or deleted contact?

I am able to get a generic notification "that there was a change to the contacts DB", but I want to know the specific record that was inserted, updated, or deleted. Following is the code that gets registered and gets the onChange notification. …
mobibob
  • 8,030
  • 17
  • 76
  • 126
22
votes
2 answers

What is the difference in contacts versus raw-contacts?

I have a "dump" utility that I am using to study the ContactsContract since I don't quite get it in the documentation. When I dump the contacts it counts 263 records in the table, however, the contacts application on my device lists that I have 244…
mobibob
  • 8,030
  • 17
  • 76
  • 126
20
votes
1 answer

How do implicit joined columns work with Android contacts data?

I'm querying the ContactsContract.Data table to find phone records. I get an error when I create a new CursorLoader: java.lang.IllegalArgumentException: Invalid column deleted My code: import…
20
votes
2 answers

How to get Contact ID, Email, Phone number in one SQLite query ? Contacts Android Optimization

I want to fetch All Contacts atleast with one phone Number, also I want all Phone Numbers and All emails for every Contact. Current code : // To get All Contacts having atleast one phone number. Uri uri =…
Sagar
  • 1,232
  • 7
  • 21
  • 48
18
votes
1 answer

Modifying contact information

I'm trying to insert and update a piece of information on an existing contact so I've created a sample application in order to develop the functionality. All I want my sample app to do is to insert (or if present) update an email address on a…
Graeme
  • 24,857
  • 23
  • 121
  • 182
16
votes
4 answers

Insert contact in Android with ContactsContract

I am trying to add a new contact to the Android 2.2 contacts directly. //this code doesn't work ContentValues cv=new ContentValues(); cv.put(ContactsContract.Contacts.DISPLAY_NAME, "TESTEST"); Uri u=…
Juliet
  • 1,010
  • 3
  • 11
  • 18
14
votes
2 answers

Create Invisible Contacts Group in Android

What I want is to hide contacts from the contact list. So to achieve this I tried a lot and searched a lot. Finally I've come to know that we can generate an invisible group and we can assign contacts to that group so that contacts will be…
The Zero
  • 1,373
  • 9
  • 21
13
votes
1 answer

Android 3.0 - How to retrieve ALL contacts via ContactsContract

I am working on an Android Honeycomb (v3.0) application that has a requirement of displaying ALL contacts stored within the Google account that is registered on the device. One of the problems I am having is that I can only retrieve the contacts…
13
votes
3 answers

What is the default Account Type / Name for contacts on Android Contact Application?

I would like to read contacts from ContactsContract API which belongs only to Phone / SIM and would like to avoid contacts synced from other apps like facebook and gmail. I tested my code on simulator and it works fine but on real devices it doesn't…
Rahul Choudhary
  • 3,729
  • 2
  • 27
  • 30
13
votes
4 answers

Insert Contact (ContactsContract) via Intent with Image (Photo)

There is many Q&A threads, but none of them is providing real answer, or I couldn't find it. To ensure you, I've searched before asking: Android: set contact photo with ContactsContract insert intent (invalid answer) Insert contact in Android with…
12
votes
1 answer

How to create a contact programmatically

Possible Duplicate: How to add new contacts in android public boolean createContact(String name, String number, String email) { boolean success = true; try { ContentValues contentValues = new…
KK_07k11A0585
  • 2,313
  • 3
  • 23
  • 31
1
2 3
36 37