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.

551 questions
4
votes
1 answer

difference between RawContacts.CONTENT_URI and ContactsContract.Contacts.CONTENT_URI in android

what is the difference between RawContacts.CONTENT_URI and ContactsContract.Contacts.CONTENT_URI in android? I am trying to write a service which listens to changes in native address book. So, which one to use? thanks Niz
Nizzy
  • 1,879
  • 3
  • 21
  • 33
4
votes
2 answers

Querying Contacts with Partial Data

I've been trying to replicate some of the OEM dialer app behaviors regarding contact matching without much luck. Basically, I'd like to populate a list of potential contact matches as the user types numbers into the dialer that match the typed…
user888867
  • 540
  • 5
  • 16
4
votes
3 answers

how to open native contact card by URI

Can someone please explain me how to open contact native for specific contact URi I manage to resolve the contact URI by: Uri lookupUri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, …
and_dev
  • 1,483
  • 3
  • 14
  • 17
4
votes
1 answer

Retrieval of firstname and lastname from android contacts results in '1' and 'null'

I am retrieving firstname and lastname from the android contact using the below code.DISPLAY_NAME gives back the name of the contact while firstname and lastname returns 1 and null respectively.The following is the code. ContentResolver cr =…
hemanth kumar
  • 3,068
  • 10
  • 41
  • 64
4
votes
1 answer

querying contacts - SOMETIMES returns empty cursor

I'm trying to query contact's display name: @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case REQ_CODE_PICK_CONTACT: if (resultCode == Activity.RESULT_OK) { …
nbtk
  • 3,039
  • 4
  • 21
  • 19
4
votes
3 answers

Search contacts using name as well as company (like in default android 2.3.3 contacts app)

I have developed a simple contacts application and also implemented search using name. But now I want to search using both name and company (just like how default android contacts app does). I am able to search separately using company but couldn't…
DSP
  • 487
  • 2
  • 5
  • 18
4
votes
1 answer

Android API 8 , 10 ContactsContract.Data.HAS_PHONE_NUMBER no such column

The below query runs fine on my device (API 15). It does not work in my emulator running API 8 or API 10. Here is the query: Cursor contactsCur = getContentResolver().query( ContactsContract.Data.CONTENT_URI, new String[] {…
3
votes
0 answers

Android contact: why need to requery each time use Contacts Phone List

Each many examples (website, tutorial, ebook...), when we need to see Phone number of one contact ID, we need to requery like below code: Cursor contactCursor = getContentResolver().query(uri, null, null, null, null); if…
hqt
  • 29,632
  • 51
  • 171
  • 250
3
votes
1 answer

Adding an event to ContactsContract.CommonDataKinds.Event in Android via contact picker

In an activity of my Android application, I would like to open the content picker. And when the user selects one of those contacts, there should be a new entry (an event with type "other") that is inserted into the table…
caw
  • 30,999
  • 61
  • 181
  • 291
3
votes
2 answers

Insert RawContact with a specific contactid

I am trying to create a rawcontact in android that has a specific contact id, so it is linked to other rawcontacts with the same contactid (not rawcontactid). The problem is I am unable to insert the Contact_ID into the…
3
votes
1 answer

Loading contact picture via LOOKUP_KEY and openContactPhotoInputStream convenience method

I'm modifying my app to store information on contacts using LOOKUP_KEY instead of _ID as suggested by the API docs. The only problem I'm having is that I'm no longer able to load the contact's photo. The problematic code is this one: InputStream s =…
Henrique
  • 4,921
  • 6
  • 36
  • 61
3
votes
2 answers

Android and Facebook Contact Picker Issuer

The short version of my question is: How do I access the phone numbers of contacts that were synced from 3rd party apps? Here is the long version: I can access the regular Android contacts pretty easily. The issue is when the only information in…
Lucas Bailey
  • 707
  • 1
  • 7
  • 15
3
votes
1 answer

Android 2.2 Contact Birthday Date

I am trying to get birthday date from contact details from android 2.2, can someone help me a little bit with the query. Here is my code: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); …
Johnny Ha
  • 633
  • 5
  • 21
3
votes
1 answer

How to define Photo uri in ContactsContract.Contacts?

I am trying to develop a query to retrieve contacts. However, Eclipse keeps telling me that PHOTO_THUMBNAIL_URI and PHOTO_URI cannot be resolved or is not a field. Here's my code: Uri uri = ContactsContract.Contacts.CONTENT_URI; String[]…
mmmmm5
  • 151
  • 1
  • 1
  • 14
3
votes
1 answer

How to get google contacts but not gmail contacts?

I'm extracting the information of contacts stored in the phone. I'm working on 2.1. I'm able to extract every RawContacts from the query including "auto gmail contacts" which I do not need. I've done quite a bit searching on SO but could not find…
Creniale
  • 238
  • 3
  • 16