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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:14:17+00:00 2026-06-03T09:14:17+00:00

I am currently creating a autocomplete textview which uses data from the contacts. I

  • 0

I am currently creating a autocomplete textview which uses data from the contacts. I cant seem get to fix the error on the last line

    Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
    nameList = new ArrayList<String>(); 
    while (cur.moveToNext())
    {
        nameList.add(cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)));
        nameList.add(cur.getString(cur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)));
    }

    phonenumber =(AutoCompleteTextView) this.findViewById(R.id.tosend1);

the error line is this:

  ArrayAdapter<String> adapter = newArrayAdapter <String>(this,R.layout.list_item2,nameList);

What seems to be the problem??

  • 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-03T09:14:18+00:00Added an answer on June 3, 2026 at 9:14 am

    It really helps to see the logcat errors but I found a couple mistakes and I can only guess at the rest:

    Cursor cursor = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, 
            new String[] { ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER }, 
            null, null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME);
    
    int nameIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME);
    int numberIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
    
    List<String> list = new ArrayList<String>();
    while(cursor.moveToNext()) {
        list.add(cursor.getString(nameColumn) + ": " + cursor.getString(numberColumn));
    }
    
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list);
    

    Voila, every name in your and number in your contacts.

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

Sidebar

Related Questions

I am currently creating a console application which is reading from a folder which
I am currently creating a service which connects to a DAL and that can
I am currently creating a script to synchronize users from our company's website onto
I'm currently creating a stock management system that uses multiple warehouses (with sub locations)
Im currently creating a uninstallation application which deletes the application folder. The problem is
I currently creating a project, in which a user can click on thumbnail of
I'm currently creating an AD script that can get the AD groups of one
I am currently creating a website that allows anonymous users to input data (or
I am currently creating a app in which i want to let the user
I am currently creating an application which signals readiness to other devices using a

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.