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) ...

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

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.

Solutions on the web371

  • Stack trace

    • android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0 at android.database.AbstractCursor.checkPosition(AbstractCursor.java:432) 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 org.kontalk.ui.ComposeMessageFragment.onActivityResult(ComposeMessageFragment.java:1533) at android.support.v4.app.FragmentActivity.onActivityResult(FragmentActivity.java:175) at org.kontalk.ui.ComposeMessage.onActivityResult(ComposeMessage.java:299) at android.app.Activity.dispatchActivityResult(Activity.java:5440) at android.app.ActivityThread.deliverResults(ActivityThread.java:3363) at android.app.ActivityThread.handleSendResult(ActivityThread.java:3410) at android.app.ActivityThread.access$1300(ActivityThread.java:141) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1260) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5052) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) at dalvik.system.NativeStart.main(NativeStart.java)

    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

    adawolfsadawolfs
    11 times, last one
    Indri YunitaIndri Yunita
    Once,
    spespe
    3 times, last one
    ben.slama.jihedben.slama.jihed
    8 times, last one
    faisalmohd83faisalmohd83
    Once,
    52 more bugmates