Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4046100
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:31:10+00:00 2026-05-20T13:31:10+00:00

I have a dump utility that I am using to study the ContactsContract since

  • 0

I have a “dump” utility that I am using to study the ContactsContract since I don’t quite get it in the documentation. When I dump the contacts it counts 263 records in the table, however, the contacts application on my device lists that I have 244 (“Displaying 244 contacts.”)

Can someone explain the discrepancy?

My Sprint LG’s Contacts App has display options for each of the accounts that I sync and I have gone in and checked all of them, so there shouldn’t be any filtering.

The main URI that I am using in the utility is:

    Uri uriRawContacts = ContactsContract.RawContacts.CONTENT_URI;
    String[] projection = new String [] {
            ContactsContract.RawContactsEntity._ID,
            ContactsContract.RawContactsEntity.CONTACT_ID,
            ContactsContract.RawContactsEntity.DELETED,
            ContactsContract.RawContactsEntity.AGGREGATION_MODE,
    };
    Cursor cursorRaw = cr.query(uriRawContacts, projection, null, null, null);
    DumpCursor.dumpAnyCursor(getApplicationContext(), "RawContacts", cr, cursorRaw, ",");

Followed by (for each _ID in the above query):

                long rawContactId = Long.parseLong(anyCursor.getString(anyCursor.getColumnIndex(RawContacts.CONTACT_ID)));

                Uri rawContactUri = ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId);
                 Uri entityUri = Uri.withAppendedPath(rawContactUri, Entity.CONTENT_DIRECTORY);

                 Log.d(TAG, "rawContactUri: " + rawContactUri.toString());
                 Log.d(TAG, "entityUri: " + entityUri.toString());

                 Cursor c = cr.query(entityUri, new String[] { RawContacts.SOURCE_ID, Entity.DATA_ID, Entity.MIMETYPE, Entity.DATA1 }, null, null, null);

I then loop through the first query, display all the columns in my projection, then, using the _ID field in the first query’s loop, I issue the second query and dump all of its columns.

Bullets from the answer transposed here for convenience:
Refer to the reference for more detailed explanation. More specifically, you are encouraged to read about the aggregation rules.
Ref: Click here for the original cited text that follows

  • The Contacts database is divided into 3 tables contacts, raw
    contacts, and data.
  • Each table contains column (_ID) which is an auto incremented primary
    key.
  • The data table contains all the contact info like phone number, mail id,
    address etc.
  • The raw contacts points to the actual contact created. Hence we
    use the raw contacts while adding a
    contact.
  • The user cannot add any data in the contacts table. The data in this
    table is populated internally due to
    aggregation of contacts.

The reason your logic worked for some
of the contacts is: _ID for contacts,
raw contacts remains same until there
is any contact aggregation taking
place. Lets say you add two contacts
with same name abc. Here the _ID for
raw contacts increments twice while
_ID for contacts increments only once as these two contacts gets merged due
to the aggregation of contacts

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T13:31:10+00:00Added an answer on May 20, 2026 at 1:31 pm

    This difference is due to RawContacts getting merged to Contacts due to the aggregation rule.

    You add contact to RawContacts while the list displays Contacts. Hence the count difference.

    Please find some description between Contacts, RawContacts and Data here.
    Even though the question is a different one you might be able to get the difference between Contacts and RawContacts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have come across an option to do core dump analysis by using GDB
Anyone have a workaround (without monkey patching rails) for the failure of the db:schema:dump
I have to get an email's content (HTML format) and save it to a
I have a C++ application that has some minimal leaks, and I would like
I have a blob, which I've got using: $blobData = $this->getBlobData(); $imageStream = stream_get_contents($blobData);
I have a varchar field in an h2 database that I'd like to be
I have created a replica of my production server to a test environment. I
this is my first question here and if its format is not what is
does anybody know how to figure out the assembly versions (not file versions) of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.