Question Detail

android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
        at android.database.AbstractCursor.checkPosition(AbstractCursor.java:466)
        at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136)
        at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:50)
        at android.database.CursorWrapper.getString(CursorWrapper.java:137)
        at com.jobboard.jobapp.Activity.UserEditProfileActivity.getPath(UserEditProfileActivity.java:356)
        at com.jobboard.jobapp.Activity.UserEditProfileActivity.access$1100(UserEditProfileActivity.java:58)
        at com.jobboard.jobapp.Activity.UserEditProfileActivity$2.onClick(UserEditProfileActivity.java:212)


Thread Reply

alex levine

- 4 months ago

You are trying to index which is greater than your Curser Index.

To avoid this error always check is cursor Null
 

if( cursor != null && cursor.moveToFirst() ){
//...Your logic here,
}