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

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 Stack Overflow by user1637466
, 2 years ago
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 Stack Overflow by AI.
, 6 months ago
Index -1 requested, with a size of 1
via Stack Overflow by Igal
, 2 years ago
Index 0 requested, with a size of 0
android.database.CursorIndexOutOfBoundsException: Index 1 requested, with a size of 1
at android.database.AbstractCursor.checkPosition(AbstractCursor.java:580)
at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:214)
at android.database.AbstractWindowedCursor.getInt(AbstractWindowedCursor.java:84)
at android.database.CursorWrapper.getInt(CursorWrapper.java:123)
at com.abhi.GetAllDatas.readContacts(GetAllDatas.java:71)
at com.abhi.GetAllDatas.access$0(GetAllDatas.java:47)
at com.abhi.GetAllDatas$1.onClick(GetAllDatas.java:41)

Users with the same issue

21 times, 2 months ago
9 times, 9 months ago
Once, 10 months ago
Once, 10 months ago
16 times, 1 year ago

Write tip

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