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

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 WISHY
, 2 years ago
Index 0 requested, with a size of 0
via Stack Overflow by Shubhangi gupta
, 6 months ago
Index -1 reques android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 0
via Stack Overflow by Aman Nain
, 2 years ago
Index -1 requested, with a size of 6
via Stack Overflow by user3797376
, 2 years ago
Index -1 requested, with a size of 2
via Stack Overflow by webgenius
, 2 years ago
Index -1 requested, with a size of 0
via Stack Overflow by luwionline
, 2 years ago
Index 0 requested, with a size of 0
android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
at android.database.AbstractCursor.checkPosition(AbstractCursor.java:426)
at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136)
at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:50)
at android.database.CursorWrapper.getString(CursorWrapper.java:114)
at com.appprix.app.AppLauncher.whatsappShare(AppLauncher.java:113)
at appprix.refer.ReferFragment.onClick(ReferFragment.java:74)
at android.view.View.performClick(View.java:4575)
at android.view.View$PerformClick.run(View.java:18578)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5127)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)

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.