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 7589951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:17:23+00:00 2026-05-30T20:17:23+00:00

Following is from Android Documentation You can acquire a lookup key from the contact

  • 0

Following is from Android Documentation

You can acquire a lookup key from the contact itself, it is a column
on the ContactsContract.Contacts table.

Uri lookupUri = Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey)

Cursor c = getContentResolver().query(lookupUri, new String[]{Contacts.DISPLAY_NAME},        ...);
try {
c.moveToFirst();
String displayName = c.getString(0);
} finally {
c.close();
}

but couldn’t get it to work.

I visited answers on Stackoverflow here and here but in vein.

Any help will be highly appreciated.

  • 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-30T20:17:25+00:00Added an answer on May 30, 2026 at 8:17 pm

    The code in the documentation is related to how to use the lookupKey once you get it, not how to obtain it.

    Like they said, you can acquire it from the Contacts table. So, in order to get the lookupKey for each contact in your contacts list, you can use the following projection (the rest of the code provided is only here to show the results, you can use it as you want):

    String [] PROJECTION = new String [] {  ContactsContract.Contacts.LOOKUP_KEY };
    
    Cursor cursor = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, PROJECTION, null, null, null);
    
    
    for(cursor.moveToFirst(); cursor.moveToNext(); cursor.isAfterLast()) {
         Log.d(LOG_TAG, "lookupKey for contact:  " + cursor.getString(1) + ", is: " + cursor.getString(0));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am able to retrieve all contacts from android in .vcf file using following
In TestDriven.Net I can set the following from the TestDriven.Net Options Pane Run tests
I'm wondering how Android's implementation of SQLite handles long Strings. Reading from online documentation
I am attempting to create a MapView application following the tutorial from the Android
I read about documentation of android and used following code to send a notification
I am about to start android application development. From What is NDK? documentation I
On my Android application I am customizing the ActionBar following tips from the android
Following the Android sample for populating a ListView , I query an array from
I am following the android licensing documentation ( http://developer.android.com/guide/publishing/licensing.html ) and when i get
I am writing the program for reading contacts from android.when i am executing the

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.