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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:43:38+00:00 2026-06-08T23:43:38+00:00

I faced with problem while fetching phone numbers for linked contacts on HTC phone.

  • 0

I faced with problem while fetching phone numbers for linked contacts on HTC phone.

The problem only with contacts that have phone numbers in invisible group.

E.g. I have contact in addressbook that linked from Google and Facebook accounts.

    Contact1 - Google account (contact name, email)
    Contact1 - Facebook account (contact name, phone number)

In the Contacts settings Google group is active and Facebook group is hidden.

Here what I am doing in the code.

Preparing cursor for ListView that shows only contacts with phone numbers and in visible group.

    Uri uri = ContactsContract.Contacts.CONTENT_URI;
    String[] projection = new String[] {
            ContactsContract.Contacts._ID,
            ContactsContract.Contacts.DISPLAY_NAME,
            ContactsContract.Contacts.LOOKUP_KEY
    };
    String[] selectionArgs = null;
    String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC";

    CursorLoader cursorLoader = new CursorLoader(AllContactsNewActivity.this,
            uri, projection, ContactsContract.Contacts.HAS_PHONE_NUMBER +" = 1 " + 
                    " AND " + ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '1'",
                    selectionArgs, sortOrder);

The Contact1 is presented in the list.

When user click on this contact I am fetching phone numbers from selected contact, but get empty list.

CursorLoader cursorLoader = new CursorLoader(
    AllContactsNewActivity.this,
    ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
    projection,
    ContactsContract.CommonDataKinds.Phone.CONTACT_ID + "=?",
new String[] { String.valueOf(contactId) }, null);

I have already tried to use RAW_CONTACT_ID, _ID, LOOKUP_KEY for fetching numbers but w/o luck.

Could some one give me piece of advice how I can fetch phone numbers for these contacts or just not show such contacts in the ListView.

  • 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-06-08T23:43:39+00:00Added an answer on June 8, 2026 at 11:43 pm

    I had this exact same problem and searched for hours to find a solution. This is probably too late for you, but if you use the following code the facebook contacts are not included in the listing.

    Please note that this uses deprecated code. I suspect, however, that we are stuck using it until facebook gets their act together and stops violating every rule Google ever made regarding contacts.

    Calling code:

    Intent intent = new Intent(Intent.ACTION_PICK, Contacts.Phones.CONTENT_URI);
    startActivityForResult(intent, SELECT_CONTACT);
    

    Later in onActivityResult

    Uri contactData = data.getData();
    Cursor c =  managedQuery(contactData, null, null, null, null);
    startManagingCursor(c);
    if (c.moveToFirst()) {
        String name = c.getString(c.getColumnIndexOrThrow(People.NAME));  
        String number = c.getString(c.getColumnIndexOrThrow(People.NUMBER));
        Toast.makeText(this,  name + " has number " + number, Toast.LENGTH_LONG).show();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We've faced strange problem. We have log on service, that authenticates user, adds auth
i have faced this problem couple of days ago, while trying to import an
I have faced a problem while designing chess game. There are 2 Player: p1,
I saw that some others faced this similar problem. I have read and checked
i have faced some problem while navigating from one class to another with the
I faced a problem while writing a code in Matlab that calculates sum of
I faced a problem while using threading for the first time, In an SWT
I faced a problem that I can not find a way to change the
I have faced a problem in Qt with error: cannot convert parameter 1 from
i faced a problem while replaying a script created for yahoomail page.The XPath statement

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.