title: Android : Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it
body: <p>I am new to android and trying to fetch sms conversation for a specific number using the code shown below. This code results in a bunch of errors.</p>
  
  <p>Can any one help me how to fix this issues?</p>
  
  <pre><code>String add = "address="+"'"+number+"'";
          Uri uriSms = Uri.parse("content://mms-sms/conversations?simple=true");
          String[] projection = new String[]{"_id", "address", "person", "body", "date", "type"};
          Cursor cursor = getContentResolver().query(uriSms,projection ,add,null,"date desc");
          if (cursor.moveToFirst()) {
                  int index_Address = cursor.getColumnIndex("address");  
                  int index_Person = cursor.getColumnIndex("person");  
                  int index_Body = cursor.getColumnIndex("body"); 
  </code></pre>
  
  <p>Logcat  </p>
  
  <pre><code>04-02 13:21:14.912: E/CursorWindow(836): Failed to read row 0, column -1 from a CursorWindow which has 16 rows, 16 columns.
      04-02 13:21:14.922: E/AndroidRuntime(836): FATAL EXCEPTION: main
      04-02 13:21:14.922: E/AndroidRuntime(836): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.second/com.example.second.CInfo}: java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow.  Make sure the Cursor is initialized correctly before accessing data from it.
      04-02 13:21:14.922: E/AndroidRuntime(836):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2114)
      04-02 13:21:14.922: E/AndroidRuntime(836):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2139)
      04-02 13:21:14.922: E/AndroidRuntime(836):  at android.app.ActivityThread.access$700(ActivityThread.java:143)
      04-02 13:21:14.922: E/AndroidRuntime(836):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241)
      04-02 13:21:14.922: E/AndroidRuntime(836):  at android.os.Handler.dispatchMessage(Handler.java:99)
      04-02 13:21:14.922: E/AndroidRuntime(836):  at android.os.Looper.loop(Looper.java:137)
      04-02 13:21:14.922: E/AndroidRuntime(836):  at android.app.ActivityThread.main(ActivityThread.java:4960)
      04-02 13:21:14.922: E/AndroidRuntime(836):  at java.lang.reflect.Method.invokeNative(Native Method)
      04-02 13:21:14.922: E/AndroidRuntime(836):  at java.lang.reflect.Method.invoke(Method.java:511)
      04-02 13:21:14.922: E/AndroidRuntime(836):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
      04-02 13:21:14.922: E/AndroidRuntime(836):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
      04-02 13:21:14.922: E/AndroidRuntime(836):  at dalvik.system.NativeStart.main(Native Method)
      04-02 13:21:14.922: E/AndroidRuntime(836): Caused by: java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow.  Make sure the Cursor is initialized correctly before accessing data from it.
      04-02 13:21:14.922: E/AndroidRuntime(836):  at android.database.CursorWindow.nativeGetString(Native Method)
      04-02 13:21:14.922: E/AndroidRuntime(836):  at android.database.CursorWindow.getString(CursorWindow.java:438)
      04-02 13:21:14.922: E/AndroidRuntime(836):  at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51)
      04-02 13:21:14.922: E/AndroidRuntime(836):  at android.database.CursorWrapper.getString(CursorWrapper.java:114)
      04-02 13:21:14.922: E/AndroidRuntime(836):  at com.example.second.CInfo.fetchConversations(CInfo.java:96)
      04-02 13:21:14.922: E/AndroidRuntime(836):  at com.example.second.CInfo.onCreate(CInfo.java:54)
      04-02 13:21:14.922: E/AndroidRuntime(836):  at android.app.Activity.performCreate(Activity.java:5203)
      04-02 13:21:14.922: E/AndroidRuntime(836):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
      04-02 13:21:14.922: E/AndroidRuntime(836):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2078)
  </code></pre>