Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how many contacts in contact list

How can I tell how many contacts there are in the contact list? I got the contact number, but one person can have more than one contact and I want to account for this in finding the total number of contacts in the contact list.

like image 591
nimi Avatar asked Nov 27 '10 05:11

nimi


People also ask

How many contacts do I have in my contact list?

Open your contacts and pull down the menu and tick delete. Go to the top left and check selected and it will show the total. Then just be sure and back out.

How many contacts is normal?

They found that the average (mean) network size of those surveyed was 611 people. Taken by itself, this number is dramatically larger than Dunbar's estimate. But while the mean network size was 611 contacts, the median was 472 contacts.

Is there a limit to how many contacts you can have on iPhone?

iPhone, iPad and Mac users can now store up to 50,000 contacts between their iCloud-enabled devices, while all other limits for calendars, reminders and bookmarks have not been changed.

How many contacts can be saved?

eMMC) or external storage (SD or SIM). Bascially there is no limitation of the quantity of contacts if the storage is large enough. Reminder: If you use Google account for synchronizing your contacts, please note the maximum of contacts for Google account is 25,000.


2 Answers

To find the count of phone numbers of all the contacts

Cursor cursor =  managedQuery(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null);

int count = cursor.getCount();

To find the count of all the phone numbers of a particular RawContactID (pass the contact id value in rawContactId).

Cursor cursor =  managedQuery(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.RAW_CONTACT_ID + " = " + rawContactId, null, null);

    int count = cursor.getCount();

The number of contacts displayed in the ContactsListActivity consists can be determined by following query.

Cursor cursor =  managedQuery(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);

int count = cursor.getCount();

However if a person has been entered under multiple accounts then only a single instance is obtained by the above query as ContactsContract.Contacts combines all such contacts.

Cursor cursor =  managedQuery(RawContacts.CONTENT_URI, null, null, null, null);

int count = cursor.getCount();

The relation between ContactsContract.Contacts and RawContacts can be found out at http://developer.android.com/resources/articles/contacts.html

Hope this resolves your doubt!

like image 190
Manish Khot Avatar answered Oct 05 '22 16:10

Manish Khot


A really old thread, but if you want to count contacts WITH phone numbers you can use this:

Cursor cursor =  managedQuery(ContactsContract.Contacts.CONTENT_URI, null, ContactsContract.Contacts.HAS_PHONE_NUMBER, null, null);
int count = cursor.getCount();

Of course managedQuery is deprecated now, but this can help in a bind :)

like image 21
suomi35 Avatar answered Oct 05 '22 15:10

suomi35