Android Illegal Argument Exception
<p>I have the following program  i got the exception below,</p>

<pre><code>     package com.contacts;

      import java.util.ArrayList;
       import android.app.ListActivity;
     import android.content.ContentResolver;
   import android.content.Intent;
    import android.database.Cursor;
   import android.net.Uri;
    import android.os.Bundle;
    import android.provider.ContactsContract;
    import android.provider.Contacts.People;
    import android.provider.Contacts.People.Phones;
  import android.provider.ContactsContract.PhoneLookup;
   import android.view.View;
 import android.widget.ArrayAdapter;
  import android.widget.ListAdapter;
  import android.widget.ListView;

   public class PickContact extends ListActivity {

  private ListAdapter adapter;
  private Cursor c;
Uri contactUri;
 String contact;
 String number;
     ContentResolver contentResolver;
   @Override
       public void onCreate(Bundle icicle) 
            {
             super.onCreate(icicle);
             setContentView(R.layout.main);

             ArrayList&lt;String&gt; names = new ArrayList&lt;String&gt;();

             Cursor people = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
             try
             {
             while(people.moveToNext()) {
              int nameFieldColumnIndex = people.getColumnIndex(PhoneLookup.DISPLAY_NAME);
               contact = people.getString(nameFieldColumnIndex);
              int numberFieldColumnIndex = people.getColumnIndex(PhoneLookup.NUMBER);
              number = people.getString(numberFieldColumnIndex);
             }

             people.close();
             }
             catch(Exception e)
             {
                 e.printStackTrace();

             }

           /*  ContentResolver cr = getContentResolver();
             c = cr.query(ContactsContract.Contacts.CONTENT_URI, null,
                     null, null,null);

             while(c.moveToNext()){
                     String id =
              c.getString(c.getColumnIndex(ContactsContract.Contacts._ID));
                      String name =
              c.getString(c.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
                      String number =
              c.getString(c.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER));

                      if(number.equals("0")) continue;

                      names.add(name);

              }*/


             names.add(number+""+contact);

              adapter = new ArrayAdapter&lt;String&gt;    (this,
                      android.R.layout.simple_list_item_1, names);
             setListAdapter(adapter);
             getListView().setTextFilterEnabled(true);

      }
</code></pre>

<p>}</p>

<p>I got the Following Exception</p>

<pre><code>09-29 17:59:18.672: WARN/System.err(302): java.lang.IllegalStateException: get field slot from row 0 col -1 failed
09-29 17:59:18.721: WARN/System.err(302):     at android.database.CursorWindow.getString_native(Native Method)
09-29 17:59:18.721: WARN/System.err(302):     at android.database.CursorWindow.getString(CursorWindow.java:329)
09-29 17:59:18.731: WARN/System.err(302):     at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:49)
09-29 17:59:18.731: WARN/System.err(302):     at android.database.CursorWrapper.getString(CursorWrapper.java:135)
09-29 17:59:18.741: WARN/System.err(302):     at com.contacts.PickContact.onCreate(PickContact.java:42)
09-29 17:59:18.741: WARN/System.err(302):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-29 17:59:18.741: WARN/System.err(302):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
09-29 17:59:18.764: WARN/System.err(302):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
09-29 17:59:18.764: WARN/System.err(302):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
09-29 17:59:18.764: WARN/System.err(302):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
09-29 17:59:18.771: WARN/System.err(302):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-29 17:59:18.792: WARN/System.err(302):     at android.os.Looper.loop(Looper.java:123)
09-29 17:59:18.792: WARN/System.err(302):     at android.app.ActivityThread.main(ActivityThread.java:4627)
09-29 17:59:18.792: WARN/System.err(302):     at java.lang.reflect.Method.invokeNative(Native Method)
09-29 17:59:18.792: WARN/System.err(302):     at java.lang.reflect.Method.invoke(Method.java:521)
09-29 17:59:18.822: WARN/System.err(302):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-29 17:59:18.822: WARN/System.err(302):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-29 17:59:18.822: WARN/System.err(302):     at dalvik.system.NativeStart.main(Native Method)
</code></pre>
