title: Cursor Index Out Of Bounds Error Android?
body: <p>Hey I am getting index out of bounds error in my code.</p>
  
  <p>From Activity:</p>
  
  <pre><code>            Cursor cursor = mDbHelper.fetchA(b);
              @SuppressWarnings("static-access")
              int a = (int) cursor.getDouble(cursor.getColumnIndex(mDbHelper.KEY_I));
              cursor.close();
  </code></pre>
  
  <p>My DB Adaptor:</p>
  
  <pre><code>public Cursor fetchA(String b){
      return mDb.query(DATABASE_TABLE, new String[] {KEY_I}, "b=\""+B+"\"", null, null, null, null);
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>    E/AndroidRuntime( 5766): FATAL EXCEPTION: main
  
      E/AndroidRuntime( 5766): android.database.CursorIndexOutOfBoundsException: Index
  
       -1 requested, with a size of 1
  </code></pre>
  
  <p>How can I fix this?</p>