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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:44:17+00:00 2026-06-01T11:44:17+00:00

I need a little help with this.. I need to take only the numbers

  • 0

I need a little help with this.. I need to take only the numbers of type Mobile in this contacts list.

with this code I extract ALL the numbers, Instead I need to take only mobile type..and show them in the list.
help me, and thanks in advance!

code:

void ReadContacts(String sort) {
        final Uri uri = Phone.CONTENT_URI;
         final String[] projection = new String[] {
                Contacts._ID,
                 Phone.NUMBER,
                 Contacts.DISPLAY_NAME,
                 Phone.TYPE
         };
        String selection = ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '1'";
        String[] selectionArgs = null;
        final String sortOrder = Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC";

        m_curContacts = managedQuery(uri, projection, selection, selectionArgs, sortOrder);
        String[] fields = new String[] {Contacts.DISPLAY_NAME, Phone.NUMBER};
        m_slvAdapter = new SimpleCursorAdapter(this,R.layout.simple_list_item_mio,m_curContacts,fields, 
                new int[] {R.id.text1, R.id.text2});           

        m_slvAdapter.setFilterQueryProvider(new FilterQueryProvider() { 
            public Cursor runQuery(CharSequence constraint) {
                Log.d(LOG_TAG, "runQuery constraint:"+constraint);
                String selection = ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '1'" +
                    " AND "+ Contacts.DISPLAY_NAME + " LIKE '%"+constraint+"%'";
                String[] selectionArgs = null;//new String[]{"'1'"};//, };
                Cursor cur = managedQuery(uri, projection, selection, selectionArgs, sortOrder);
                return cur;
            }

        });

ps: the Phone.TYPE mobile is int 2.

  • 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-01T11:44:19+00:00Added an answer on June 1, 2026 at 11:44 am

    set Selection and selectionArg to following:

    selection="ContactsContract.Contacts.IN_VISIBLE_GROUP =? and Phone.TYPE=?";
    selectionArgs=new String[]{"1", "2"};
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a little help on this subject. I have a Web application written
I know I'm close to figuring this out but need a little help. What
Need a little help with my jquery here I want all my button with
I need a little help creating a catch-all error handling page in my ICEfaces
Hey all i am in need of a little help with figuring out how
need a little help with this one. I have a form that I am
I'm so close on this one, but I need a little help. I have
I am getting a little confused and need some help please. Take these two
I need a little help with this: android developers, Tutorials: OpenGLES10. a link It
I need a little help with this, I am trying to insert some data

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.