android.database.CursorIndexOutOfBoundsException

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
tip

You have an empty cursor. Check your query if it is not expected, or handle empty cursor with `if(cursor.getCount() > 0) ...`

tip

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

tip

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


rprp

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

  • GitHub comment 124#225859686
    via GitHub by VDK
    ,
  • Update via Jsoup not working well
    via Stack Overflow by T. Lima
    ,
  • Strange error at super.onStart();
    via Stack Overflow by José Mª
    ,
  • INSERT INTO in database in Android
    via Stack Overflow by AJay
    ,
    • android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0 at android.database.AbstractCursor.checkPosition(AbstractCursor.java:460) at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136) at android.database.AbstractWindowedCursor.getInt(AbstractWindowedCursor.java:68) at fr.free.nrw.commons.contributions.Contribution.fromCursor(Contribution.java:224) at fr.free.nrw.commons.modifications.ModificationsSyncAdapter.onPerformSync(ModificationsSyncAdapter.java:90) at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:272)

    Users with the same issue

    Ranjana DangolRanjana Dangol
    2 times, last one,
    bayukresnobayukresno
    2 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    nageshnagesh
    1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    51 more bugmates