android.database.CursorIndexOutOfBoundsException

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
tip

You have an empty cursor. Check your query if it is not expected, or handle empty cursor with `if(cursor.getCount() > 0) ...`

tip

When you get a Cursor returned from the database you should do an moveToFirst(); before trying to get data from it.

tip

You need to make sure that there is a data in the cursor. Check that moveToFirst() return true.


rprp

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • Phone type and Email type not working?
    via Stack Overflow by Beginner
    ,
  • 안드로이드사이드
    via by Unknown author,
  • App crashes on incoming SMS
    via GitHub by di72nn
    ,
  • Getting RawContact id using Contact id
    via Stack Overflow by vamsiampolu
    ,
  • Strange error at super.onStart();
    via Stack Overflow by José Mª
    ,
    • android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 10 at android.database.AbstractCursor.checkPosition(AbstractCursor.java:418) at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136) at android.database.AbstractWindowedCursor.getInt(AbstractWindowedCursor.java:68) at android.database.CursorWrapper.getInt(CursorWrapper.java:102) at org.tomdroid.ui.Tomdroid.showNoteInPane(Tomdroid.java:835) at org.tomdroid.ui.Tomdroid.onConfigurationChanged(Tomdroid.java:782) at android.app.ActivityThread.performConfigurationChanged(ActivityThread.java:3618) at android.app.ActivityThread.handleConfigurationChanged(ActivityThread.java:3746) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4745) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method)

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,
    faisalmohd83faisalmohd83
    2 times, last one,
    filpgamefilpgame
    9 times, last one,
    Unknown visitor
    Unknown visitor2 times, last one,
    Indri YunitaIndri Yunita
    1 times, last one,
    51 more bugmates