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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:45:42+00:00 2026-05-16T16:45:42+00:00

A few weeks ago I asked exactly the same question here . At first,

  • 0

A few weeks ago I asked exactly the same question here. At first, I thought the answers solved my problem, but they didn’t. I just didn’t notice that I wasn’t able to solve my problem with those answers.

However, what I’ve got now is:

final Cursor phoneCursor = context.getContentResolver().query(Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode("'" + incomingNumber + "'")), null, null, null, null);
phoneCursor.moveToFirst();

String lookupString = phoneCursor.getString(phoneCursor.getColumnIndex(PhoneLookup.LOOKUP_KEY));

final Cursor dataCursor = context.getContentResolver().query(ContactsContract.Data.CONTENT_URI, null, ContactsContract.Data.LOOKUP_KEY + "=" + "'" + lookupString + "'", null, null);
dataCursor.moveToFirst();

Log.e("smn", "display_name: " + dataCursor.getString(dataCursor.getColumnIndex(ContactsContract.Data.DISPLAY_NAME)));
Log.e("smn", "nickname: " + dataCursor.getString(dataCursor.getColumnIndex(ContactsContract.Data.DATA1)));

Output looks like this:

08-14 17:41:02.106: ERROR/smn(20146): display_name: Tom Tasche
08-14 17:41:02.106: ERROR/smn(20146): nickname: null

This answer told me that Nicknames are held in Data-table, but although I’m querying Data-table, I don’t retrieve the contact’s alias saved in my addressbook.

contact with alias

I already tried it the other way: I inserted a new alias for this contact. And that worked fine. So, nicknames seem to work.
Additionally, I’ve printed out every field that’s saved in Data-table, again, without no luck.

Any ideas? Maybe I’m doing something completely wrong, but at the moment I don’t see what’s the problem…

Thanks for your help

Tom

  • 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-16T16:45:42+00:00Added an answer on May 16, 2026 at 4:45 pm

    I found a “workaround”:

    Uri uri = Uri.withAppendedPath(Contacts.CONTENT_VCARD_URI, lookup);
    InputStream stream = settings.context.getContentResolver().openInputStream(uri);
    
    int length = stream.available();
    if (length <= 0) {
        return;
    }
    
    byte[] vcard = new byte[length];
    int bytesRead = stream.read(vcard, 0, length);
    if (bytesRead < length) {
        return;
    }
    
    String vcardString = new String(vcard, 0, bytesRead, "UTF-8");
    
    String SPLIT = "X-ANDROID-CUSTOM:vnd.android.cursor.item/nickname;";
    if (vcardString.contains(SPLIT)) {
        vcardString = vcardString.substring(vcardString.indexOf(SPLIT) + SPLIT.length());
        vcardString = vcardString.substring(0, vcardString.indexOf(';'));
    
        name = vcardString;
    }
    

    It’s really stupid, but it works and it’s not that slow (~300 milliseconds).

    Good luck

    Tom

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

Sidebar

Related Questions

I asked a similar question a few weeks ago, but now the requirements have
I asked a question on here a few weeks ago, and everyone said I
A few weeks ago, I asked a question about how to generate hierarchical XML
i asked this a few weeks ago, but couldnt get any of the suggested
I was actually asked this myself a few weeks ago, whereas I know exactly
A few weeks ago I asked a question about eliminating duplicate records in a
I asked a similar question a few weeks ago on how to split a
I asked from few weeks ago this question: How can I teach a beginner
Few weeks ago I asked a question on increasing the speed of a function
A few weeks ago I asked the question Is a PHP, Python, PostgreSQL design

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.