android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0


Samebug tips3

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 KristianMedK

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


,
via stackoverflow.com by Unknown author

Solutions on the web377

Solution icon of googlegroups
via Google Groups by 籐野リタ, 9 months ago
Index 0 requested, with a size of 0

Solution icon of github
via GitHub by kordianbruck
, 1 year ago
Index 0 requested, with a size of 0

Solution icon of github
via GitHub by VDK
, 1 year ago
Index 0 requested, with a size of 0

Solution icon of github
via GitHub by janlem
, 9 months ago
Index 0 requested, with a size of 0

Solution icon of github
Index 0 requested, with a size of 0

Solution icon of github
Index 0 requested, with a size of 0

Solution icon of github
via GitHub by di72nn
, 11 months ago
Index 0 requested, with a size of 0

Solution icon of stackoverflow
Index 0 requested, with a size of 0

Solution icon of stackoverflow
Index 0 requested, with a size of 0

Solution icon of stackoverflow
Index 0 requested, with a size of 0

Stack trace

android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a
 size of 0
	at android.database.AbstractCursor.checkPosition(AbstractCursor.java:424)
	at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:50)
	at jp.example.quiz.QuestionActivity.onClick(QuestionActivity.java:97)
	at jp.example.quiz.QuestionActivity.onQuestion(QuestionActivity.java:55)
	at android.view.View.performClick(View.java:4207)

Write tip

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

Users with the same issue

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