android.database.CursorIndexOutOfBoundsException

Index 3 requested, with a size of 3

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

  • via Unknown by Unknown author,
  • Stack trace

    • android.database.CursorIndexOutOfBoundsException: Index 3 requested, with a size of 3 at android.database.AbstractCursor.checkPosition(AbstractCursor.java:426) at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:147) at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:61) at android.database.CursorWrapper.getString(CursorWrapper.java:114) at com.phase3.mascotnew.SelectRecipeActivity$MyCursorAdapter.getView(SelectRecipeActivity.java:145) at android.widget.AbsListView.obtainView(AbsListView.java:2338) at android.widget.ListView.makeAndAddView(ListView.java:1813) at android.widget.ListView.fillDown(ListView.java:698) at android.widget.ListView.fillFromTop(ListView.java:759) at android.widget.ListView.layoutChildren(ListView.java:1646) at android.widget.AbsListView.onLayout(AbsListView.java:2149) at android.view.View.layout(View.java:15140) at android.view.ViewGroup.layout(ViewGroup.java:4867) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1160) at android.view.View.layout(View.java:15140) at android.view.ViewGroup.layout(ViewGroup.java:4867) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:515) at android.widget.FrameLayout.onLayout(FrameLayout.java:450) at android.view.View.layout(View.java:15140) at android.view.ViewGroup.layout(ViewGroup.java:4867) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1888) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1742) at android.widget.LinearLayout.onLayout(LinearLayout.java:1651) at android.view.View.layout(View.java:15140) at android.view.ViewGroup.layout(ViewGroup.java:4867) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:515) at android.widget.FrameLayout.onLayout(FrameLayout.java:450) at android.view.View.layout(View.java:15140) at android.view.ViewGroup.layout(ViewGroup.java:4867) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2474) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2180) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1246) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6412) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:788) at android.view.Choreographer.doCallbacks(Choreographer.java:591) at android.view.Choreographer.doFrame(Choreographer.java:560) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:774) at android.os.Handler.handleCallback(Handler.java:808) at android.os.Handler.dispatchMessage(Handler.java:103) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:5299) 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:829) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645) at dalvik.system.NativeStart.main(Native Method)

    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

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