android.database.CursorIndexOutOfBoundsException

后端 未结 3 1285
再見小時候
再見小時候 2021-02-14 15:21

The data access code in my Android app raises an exception.

Here is the code that causes the exception:

String getPost = \"SELECT * FROM \" + TABLE_POST          


        
3条回答
  •  心在旅途
    2021-02-14 15:41

    This arises in the case our Cursor has data but not yet pointing to first index in the data list.

    To get avoid this exception, we first should check:

    if (!cursor.moveToFirst())
            cursor.moveToFirst();
    

    And then carry the further actions.

提交回复
热议问题