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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:31:50+00:00 2026-05-30T00:31:50+00:00

I am using Filter with ListView which is populated trough Contact data which contains

  • 0

I am using Filter with ListView which is populated trough Contact data which contains Names and Number.

Now i got two problems when i type a text into EditText which in turns fires adapter.getFilter().filter(s.toString())

1) When i type ‘aa’ latter (in my code )

i can see name starting from ‘aa’ for example aakruti , but at the
same time i am able to view email addresses too , which i don’t wanted
to make it visible when a filter is fired.

enter image description here

2) When i type ‘aa’ latter (in phone’s inbuilt contact list)

i can see name starting from ‘aa’ for example aakruti

but i am missing one name i.e. S A T Y A ( which is shown by contact
search when i type ‘aa’ latter into it )

enter image description here

here is my filter query , inside runQueryOnBackgroundThread

StringBuilder buffer = null;
String[] args = null;
    if (constraint != null) {
    buffer = new StringBuilder();
    buffer.append("UPPER(");
    buffer.append(ContactsContract.Contacts.DISPLAY_NAME);
    buffer.append(") GLOB ?");
    args = new String[] { constraint.toString().toUpperCase() + "*" };
    }
String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC";
System.out.println(buffer);
return mContent.query(
            ContactsContract.Contacts.CONTENT_URI, 
            projection,
            buffer == null ? null : buffer.toString(), 
            args,sortOrder
);

projection data

   public static String[] projection = new String[] {
           ContactsContract.Contacts._ID,
           ContactsContract.Contacts.DISPLAY_NAME

   };

EDIT

So far i tried to access

ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME
ContactsContract.CommonDataKinds.StructuredName.MIDDLE_NAME
ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME
ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME

But GIVEN_NAME displays few email address too and even it shows contact name which has email address

for example ,

xyz@gmail.com 
Raul Jakson          (which only has email address no contact number)
Raul Jakson          ( i see this name twice as it has two different email address , but i wanna see it as name )

so can anyone tell me how can i limit the email addresses and show only NAMES which has only contact phone numbers ?

  • 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-30T00:31:51+00:00Added an answer on May 30, 2026 at 12:31 am

    Firstly, the emails show up because that contact has no name. In these cases, Android will use the email as the display name. To avoid showing these, use GIVEN_NAME and FAMILY_NAME. See the api docs for StructuredName.

    Secondly, you don’t find SATIYA as your query is looking for a DISPLAY_NAME that begins with AA. SATIYA is not a word, it’s a sequence of initials, e.g. S A T I Y A. If you want to find these, then you’ll have to craft your query to cater for this. You could search for *A*A*, but you’ll probably get many others hits too. I suspect Android is doing some variant of an initial+surname search where BO would find Barack Obama.

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

Sidebar

Related Questions

I have a ListView which is populated by a SQLite query in OnCreate using
I'm using a filter to log exceptions thrown by actions which looks like this:
I have a text file which I want to filter using awk. The text
I am using PHP filter to perfom basic sanitization and validation of form data.
I have a single NSDictionary object which contains a large number of custom objects.
I have a listview which loads its data from sqlite database. Each row in
I have a ListView control which I used to populate using an ASP ObjectDataSource
I'm trying to filter a listview, using a textbox control via an object datasource.
I'm using a FilterQueryProvider to filter the content of a list view which is
I'm trying to create a UserControl that contains a ListView and a number 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.