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

  • SEARCH
  • Home
  • 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 3810334
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:26:40+00:00 2026-05-19T15:26:40+00:00

I read that the different entries in different tables are linked via the _ID

  • 0

I read that the different entries in different tables are linked via the _ID column in that table. For example a contact might have an _ID = 1 I get via

ContactsContract.Contacts._ID

and now I want to read the phone number of that contact using

Cursor phoneCursor = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " + contactId , null, null); 
//...
String number = phoneCursor.getString(phoneCursor.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Phone.NUMBER));
String id = phoneCursor.getString(phoneCursor.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Phone._ID));

This works fine, but what I would expect is that if the _ID of the contact is 1 that the _ID of the phone number is as well one since they belong together, but they are not equal. So the question is how does Android match these entries?

Thanks, A.

  • 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-19T15:26:40+00:00Added an answer on May 19, 2026 at 3:26 pm

    you could get more details when you see the database tables

    as far as my understanding goes this is the information I got from viewing android contacts2.db file using sqlite3 db browser

    I created some 6 contacts for testing my android contacts

    in contacts table the _id and raw_contact_id is actually same (it means that ContactsContract.Contacts provider )

    in data table we get the real details of the person like phone number and email and firstname and last name using mimetype Id as the where condition

    when considering data table use raw_contact_id as the where condition to get a particular records of the contact

    ex my raw_contact_id is 1

    I got 3 rows which consists of email, phone and display name in data1 column

    you may ask that what if we want only phone or email or display name ….there you will need the mimetype_id as the where condition

    to get phonenumber mimetype_id is 5
    to get display_name mimetype_id is 6
    to get email mimetype_id is 1

    you may not understand all these stuff if you are a beginner …but once if u see the internal tables u get every thing which I told you

    access contact details only by contact_id or raw_contact_id and not by _id which is in every table ..that column is for different purpose ..

    you can have a look at what Im saying in this image
    http://img94.imageshack.us/i/tablesxa.jpg

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

Sidebar

Related Questions

I have a huge array that has to be read by different threads in
I have read through about every possible solution online, and I get a different
I read somewhere that body temperature can be measured through touch screen since different
I read somewhere that the ?: operator in C is slightly different in C++,
I read that some webmail services prefetch url links in emails. The GET request
I read that .NET uses connection pooling. For example, if I instantiate a bunch
I read that when you don't have access to the web server's headers you
I read that Linux kernel is preemptive, which is different from most Unix kernels.
I have a question that relates to setting up the third table ( Repair_Parts
I have a table named KEYWORDS with a column named ENTRY of VARCHAR(10). Would

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.