android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 10

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

,
via Stack Overflow by KristianMedK

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

,
via Stack Overflow by Rejinderi

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

Solutions on the web

via Stack Overflow by Beginner
, 2 years ago
Index 1 requested, with a size of 1
via androidside.com by Unknown author, 1 year ago
via androidside.com by Unknown author, 1 year ago
Index 0 requested, with a size of 0
via xiaomi.eu by Unknown author, 2 years ago
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)

Users with the same issue

Samebug visitor profile picture
Unknown user
Once, 1 year ago
2 times, 1 year ago
21 times, 1 month ago
9 times, 8 months ago
Samebug visitor profile picture
Unknown user
2 times, 9 months ago
52 more bugmates

Know the solutions? Share your knowledge to help other developers to debug faster.