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
1
vote
1 answer

How to get last inserted RawContacts ID after newInsert into address book programactically?

I succeeded in inserting contacts into the address book and I need to save a reference of the contact in my app. I figured that the best way to save the reference is to get the RawContacts ID itself. Is there a way for me to directly get the ID back…
Creniale
  • 238
  • 3
  • 16
1
vote
1 answer

Android ContactsContract.Contacts slow

I want to put all the contacts in my phone into an array. I am using the code below but it takes 3-4 seconds to put all of them into the array. To accelerate the process, I am collecting only those contacts who has a phone number. This results in an…
erdomester
  • 11,789
  • 32
  • 132
  • 234
1
vote
0 answers

ContactsContract.CommonDataKinds and empty contacts list

I am new to Android development (coming from a C# background) and have been working through some examples in a book. I have a question about the following lines of code. public void onClick(View arg0){ Intent i = new…
user994525
  • 11
  • 2
1
vote
2 answers

NullPointerException on CustomContact insert

The code: ArrayList operationList = new ArrayList(); // Create raw contact Builder builder = ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI); …
Pim Reijersen
  • 1,123
  • 9
  • 33
1
vote
0 answers

Android: How to get the name and photo from ContactsContract?

I am new to android, I need to get the the name and photo from the address book, and display them in a list view with ImageView and TextView. Been goolging around for hours, too many different answers, I am working on Android 2.1, what is the proper…
Johnny
  • 2,800
  • 6
  • 25
  • 33
1
vote
1 answer

Get _id and display name of newly added contact : min API 7

In my application I am implementing functionality to add contact. For this purpose I am using code as Intent addNewContact = new…
Pankaj Kumar
  • 81,967
  • 29
  • 167
  • 186
1
vote
0 answers

Proper usage of ContactsContract

I have some struggles to find an up-to-date example how to properly handle ContactsContract to CRUD (create,read,update,delete) contacts. Most examples make use of "People", which is deprecated. Maybe I got just too much confused about the changes…
Alx
  • 6,275
  • 7
  • 32
  • 54
1
vote
2 answers

Map values between different data sources

Is there any chance to get a easy way to sync data, in this case contacts, between the android contentprovider and a JSON-based server? My problem is, that android uses the cursors and stuff and on the other side I have the JSON-Format. Second…
Christoph Haefner
  • 1,093
  • 1
  • 9
  • 25
1
vote
2 answers

Handling ACTION_SEND

I want to handle ACTION_SEND intent. So i get an uri of the shared item using this code: Bundle extras = intent.getExtras(); if (extras.containsKey(Intent.EXTRA_STREAM)) { Uri uri = (Uri) extras.getParcelable(Intent.EXTRA_STREAM); …
Ivan
  • 11
  • 1
1
vote
1 answer

Android: imported contacts are not visible

I'm using Adnroid dev SimpleSyncAdapter example to import cloud-based contacts into my application. The import runs fine, when I access contracts2.db in the emulator all contacts are there and raw_contacts, data and contacts tables seem to be…
Bostone
  • 36,858
  • 39
  • 167
  • 227
1
vote
1 answer

Persistant contact id

I know on some phones contact ids change even on reboot, but I can't reproduce this on my own phone. But I can reproduce following case and would like to know if this case is solveable at least: install whatsapp - it will add it's contacts to the…
prom85
  • 16,896
  • 17
  • 122
  • 242
1
vote
2 answers

How to get the recent contact list in android device

I need to fetch out the list of contacts that are recently used in last 24 hours and most frequently used. I have searched a lot but did not find any way to do that. I also come to know that google has revoked the URIs to get frequently used…
Manmohan Soni
  • 6,472
  • 2
  • 23
  • 29
1
vote
1 answer

How to read email field from contact in android?

In my app I read all the contacts from my phone into list view. After clicking on a particular view from the list, I want to read the name, phone and e-mail address. I manage to read the name and phone without a problem. But I can not get the…
1
vote
1 answer

how to get all Phone.DISPLAY_NAME_PRIMARY and phone number size onece

I want to get all contact name along with phone number size in it. Now I am using tow queries: 1. crContacts = getContentResolver() .query(ContactsContract.Contacts.CONTENT_URI, null,null, null, null) and then 2. while…
1
vote
1 answer

Android - set birthday to an existent contact

I am trying to set a birthday to the android contacts provider to an existent contact which doesn't have the field, I have tried to use the method I use to update the birthday of a contact which already has a birthday set: fun updateBirthdate(id:…
svprdga
  • 2,171
  • 1
  • 28
  • 51