Make sure the Cursor is initialized correctly before accessing data from it

后端 未结 7 487
死守一世寂寞
死守一世寂寞 2020-12-06 15:17

Im trying to get data from my DB.

This is my code:

String[] columns = new String[] {COLUMN_FACEBOOK_ALBUM_COVER, COLUMN_FACEBOOK_ALBUM_IS_ACTIVE};

          


        
7条回答
  •  一整个雨季
    2020-12-06 15:56

    You should fix this to solve the following error message

    Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.

    It works in my code.

    1. Try to position cursor by moveToFirst before reading data from it.

    2. Check for null-> if (c != null && c.moveToFirst()) {}

    3. Check for count-> (c != null && c.getCount() >0 && c.moveToFirst()){}

提交回复
热议问题