Couldn't read row 0, col -1 from CursorWindow

前端 未结 3 1564
灰色年华
灰色年华 2021-01-27 19:04

I\'m trying to get records in my table. I\'m using this code

        if(c!=null){
            if(c.moveToFirst()) {

                String tipId = c.getString(c         


        
3条回答
  •  误落风尘
    2021-01-27 19:08

    You should fix this to solve this 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. e,g; if (c != null && c.moveToFirst()) {}

    3. check for count. e,g; (c != null && c.getCount() >0 && c.moveToFirst()){}

提交回复
热议问题