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

The Archive Base Latest Questions

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

Hi guys i’m getting the following Exception while readying contact list. 04-13 13:51:15.210: E/AndroidRuntime(7343):

  • 0

Hi guys i’m getting the following Exception while readying contact list.

04-13 13:51:15.210: E/AndroidRuntime(7343): java.lang.IllegalStateException: get field slot from row 0 col -1 failed

Here is my getContact function

 public static ContactList getContactList(Context context){
    ContactList contactList = new ContactList(RequestStatus.CONTACT_LIST);
    Cursor people =     context.getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,
            null, null, null, null);
    while(people.moveToNext()) {
       int nameFieldColumnIndex = people.getColumnIndex(PhoneLookup.DISPLAY_NAME);
       String contact = people.getString(nameFieldColumnIndex);
       int numberFieldColumnIndex = people.getColumnIndex(PhoneLookup.NUMBER);
       String number = people.getString(numberFieldColumnIndex);  
       contactList.addContact(new Contact(contact,number));
    }
    people.close();
    return contactList;
}

The exception is being thrown at following line.

String number = people.getString(numberFieldColumnIndex); 

what could be wrong?

  • 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-01T17:17:05+00:00Added an answer on June 1, 2026 at 5:17 pm

    You can use the below method to get a list of contacts::

    private ContactList getDetails(){
        ContactList contactList = new ContactList(RequestStatus.CONTACT_LIST);
        Uri uri = contactsContract.CommonDataKinds.Phone.CONTENT_URI;
        ContentResolver cr = getContentResolver();
        Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI,null, null, null, null);
        String[] projection    = new String[] {ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER };
        Cursor names = getContentResolver().query(uri, projection, null, null, null);
    
        int indexName = names.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME);
        int indexNumber = names.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
        names.moveToFirst();
        do {
            String name   = names.getString(indexName);
            Log.e("Name new:", name);
            String number = names.getString(indexNumber);
            Log.e("Number new:","::"+number);
            contactList.addContact(new Contact(name,number));
        } while (names.moveToNext());
        return contactList;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Guys, I have the following code that is inside a big while loop that
Guys I made a customised list view, The list view has three text fields.
Guys, I need to develop a tool which would meet following requirements: Input: XHTML
Guys i need some help here , im getting this error here at the
Guys i want to populate a tree list view with nodes using the data
Guys I am getting response from webservice api as xml based response now the
Guys I'm getting this really weird fault with my program when I run it.
Guys I have an activity which has a home button, when the button is
guys, I would like to you evaluate next code below. As you see, I
Guys I've 3 tables as follows: Project {id, name, owner, ....} ProjectMilestones {id, project_id,

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.