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
12
votes
4 answers

Selecting a number from user with multiple numbers when using the contact picker

I'm trying to allow a user to select a phone number from a contact using the contact picker. However, right now all the examples I see online show how you can select a contact, but I am hoping to have a second screen then pop up if that contact has…
12
votes
4 answers

android edit contact

hi im trying to add a phone number to an existing contact on android 2.1. Im currently using: ContentValues values = new ContentValues(); values.put(Phone.RAW_CONTACT_ID,cursor.getColumnIndex(Phone.CONTACT_ID)); String selection =…
MindlessBarber
  • 1,590
  • 6
  • 22
  • 39
11
votes
1 answer

Android contact photo: How to get back (Google) contact picture from the web (and so, 'cancel' a former local picture change)

Am I the only one trying to achieve this ... :/ ? In short: I want to fetch back the picture of my contacts as they do defined it by themselves (on their Google own Account page for instance). Use case: I have modified one of my contact's picture…
Pascal
  • 15,257
  • 2
  • 52
  • 65
11
votes
5 answers

how to make entire row of list view clickable?

I am trying to make multiple contact picker for my application. I am using a custom layout with checkbox to select multiple contact. The problem i am facing is that in order to select any particular contact i need to click exactly on the checkbox,…
Tapan Desai
  • 848
  • 2
  • 14
  • 36
9
votes
3 answers

How to find and collect all the information available in a give contact in any android phone?

Currently I am displaying all the contacts of my phone in my app as a custom recyclerview. Till now I am showing name, mobile number and profile image of the contact on the list item view but I need to get all the information for that contact and…
9
votes
2 answers

Retrieve Contact Phone Number From URI in Android

I am trying to get the contact's phone number after I have retrieved their ID number from the built-in activity. However, whenever I query the database using the cursor in my code below -- I get zero rows returned even though there is a mobile…
hwrdprkns
  • 7,525
  • 12
  • 48
  • 69
8
votes
4 answers

Telephony.Sms.Inbox.PERSON uses deprecated Contacts.People._ID

Bounty Award - The bounty will be awarded to an answer that gets from a populated Telephony.Sms.Inbox.PERSON value, to the associated Contact using only ContractsContact tables. I'm reading SMS messages in the standard way in my application: …
brandall
  • 6,094
  • 4
  • 49
  • 103
8
votes
3 answers

Getting android contacts details very slow

My app has a listView populated by the contacts registered on the device, but when i load the listView, it takes too long! Here is my code: public List getContactsList(Context context, ContentResolver contentResolver) { List
8
votes
1 answer

Edit name/phone number of contact programmatically

I am trying to modify displayed name of a contact programmatically: try { ArrayList ops = new ArrayList(); ops.add(ContentProviderOperation.newUpdate(Data.CONTENT_URI) …
8
votes
5 answers

Displaying contacts only with phone numbers using ACTION_PICK intent in Android device

My goal is to only display contacts with phone number to user and let user select few contacts which I want to store locally. I have used various options in place of ContactsContract.Contacts.CONTENT_URI in below method. But I am getting lot many of…
Jit
  • 125
  • 3
  • 10
8
votes
1 answer

How to add structured data to a new contact Intent

I need to support Android 2.1 and up. Google posted an example of how to use the ContactsContract, but some of it used things that are available starting with API level 11, so I need to improvise, but I'm stuck. So, far I have this: …
boo-urns
  • 10,136
  • 26
  • 71
  • 107
8
votes
2 answers

Cannot insert android contacts programmatically into android device

ArrayList ops =new ArrayList(); ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI) .withValue(Data.RAW_CONTACT_ID, 3) …
Nalini Wanjale
  • 1,717
  • 4
  • 19
  • 24
8
votes
1 answer

Reading all contact data

I am on Android 2.3.3, API Level 10. I want to read all contacts and data associated to them, therefore e.g. all email addresses, phone numbers, custom fields... I tried it like this: Uri contactUri = ContactsContract.Contacts.CONTENT_URI; Cursor…
stefan.at.kotlin
  • 15,347
  • 38
  • 147
  • 270
7
votes
2 answers

How can I retrieve contact events synced from Google Contacts without a year?

I'm using the code below to retrieve a cursor for events and contacts and it's working just fine for events with a year specified. Unfortunately, events where only the day and month are set are not returned by this query. I have set these dates in…
David Snabel-Caunt
  • 57,804
  • 13
  • 114
  • 132
7
votes
3 answers

How to get Android Contact details without READ_CONTACTS permission

According to the official docs at https://developer.android.com/guide/components/intents-common#Contacts You can use a pick intent public void selectContact() { Intent intent = new…
1
2
3
36 37