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'm trying to write xpath or css to find/click on list element All
Guys can you give a good comparison regarding Oracle/PL SQL and Java in terms
Guys, I've came across this problem I can't resolve myselg, I'm pretty sure I
Guys, I am using SQL Server 2000 and executing the sp_columns stored procedure to
Guys, what is function called after my class loaded, where i can call self
guys which text editor is good for Rubyonrails? i m using Windows and i
guys please post me an example for threading in MFC....it should show the progress
guys i have arrays in which i have to match this kind of text
Guys, I HAVE tried reading tons of stuff about EJB. And I don't get

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.