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 rawcontact id with contact id and lookup key

I am trying to get rawcontacts._ID from contacts provider by using the lookup key and contact id stored in the application. This function exists that might help me but I am not sure how to construct the rawContactUri public static Uri…
androiduae
  • 153
  • 2
  • 9
1
vote
2 answers

How to set default image to Android phone contact that has no previous image

I have a piece of code which updates the an Android contact´s image, the problem is that it doesn't work when the contact has no previous image. I also checked that the contact was from "Phone" account or "*@gmail.com" account. When it already has…
1
vote
0 answers

Contacts with multiple numbers are shown multiple times in listview

i am trying to create an application to send contacts via Bluetooth. When i list the contacts contacts with multiple phone numbers are shown multiple times. How to avoid that. my code is below public class MainActivity extends Activity implements…
suhail c
  • 1,169
  • 2
  • 16
  • 40
1
vote
1 answer

Frequent queries on android contacts returns null

I'm using the following code segment to get phone numbers of a contact by contact ID private static ArrayList getPhonesFromID(Context context, String contactID, String column) { // Run query Uri uri =…
Reaz Murshed
  • 23,691
  • 13
  • 78
  • 98
1
vote
1 answer

Contacts - how to distinguish between SIM, phone and other contacts?

I'm reading ALL contacts from the phone like following: Cursor cursor = MainApp.get().getContentResolver().query( ContactsContract.Data.CONTENT_URI, null, null, null, …
prom85
  • 16,896
  • 17
  • 122
  • 242
1
vote
0 answers

Misunderstanding while querying Contacts

I have a single piece of code, which supposed to output all numbers in Contacts. However, it also outputs name of contact: import ... ; public class MainActivity extends ListActivity { private SimpleCursorAdapter adapter; …
Anarantt
  • 289
  • 1
  • 2
  • 10
1
vote
1 answer

ContactsContract doesn't work on sony xperia devices

I'm using ContactsContract to export contact to contact app. Everything works fine on every other devices, but on Sony Xperia phones all I can't save data I've put into ArrayList data. My code looks like this: ArrayList
rwojcik
  • 1,030
  • 9
  • 18
1
vote
0 answers

Unable to display contacts photo android

I'm trying to display contacts using Contactscontract. By now I'm able to read and display every contact name and phone number but I don't know how to display the thumbnail. public class Display extends Activity implements…
cdv86
  • 1
  • 3
1
vote
0 answers

Get contact groups names by contact-id in a single query?

I known how retrieve the group ids at that belongs a contact Cursor cursor = context.getContentResolver().query( ContactsContract.Data.CONTENT_URI, new String[] { ContactsContract.Data.DATA1 }, String.format("%s=? AND %s=?",…
The Matrix
  • 1,268
  • 2
  • 14
  • 23
1
vote
0 answers

Storing and retrieving contact info from ContactsContract

So, I can write to and retrieve info from the ContactsContract, however I have a question about how it works. It is my understanding that all contact information for Contacts are stored within ContactsContract.Contact and ContactsContract.Data…
Matt
  • 1,392
  • 12
  • 24
1
vote
2 answers

Display ContactContracts Name, Email, Photo in ListView, using Fragment - Android

I have an activity that needs to display Android phone contacts into a ListView which is a fragment inside my AddressBook.java activity. I was able to get my list to display the names, but nothing else. I feel like I am close, but having a hard time…
1
vote
1 answer

How to increase Contact inserting performance?

I am doing contacts inserting android app for that using applyBatch method,My content resolver showing null pointer exception. public void import_contacts(File paramFile, int paramInt) throws IOException { String[]…
1
vote
0 answers

compare a phone number using ContactsContract from mysql and the contacts of the phone

well my problem is this, I have: 1. Database in mysql with the table users 2. In the app there's a register where you put username and telephone which are stored in the table users When you have registered, in the app there's a activity Contacts…
1
vote
1 answer

Android ProgressBar not showing and native contacts lookup is slow

I have 2 issues - 1. The progress bar (spinner) is not showing at all. Its as if it was never there. 2. Is there a better way for me to look-up and load the native contact list into the arraylist? I only need the contact name and phone numbers to be…
1
vote
2 answers

Adding contacts using ContactsContract in batch

Can anyone please help me on adding new contacts in address book and apply them in batch by using new ContactsContract API? I could not find a proper tutorial on this. I am able to add a single contact. But batch update fails with Unknown contacts…
Pritam
  • 2,367
  • 5
  • 34
  • 50