CursorIndexOutOfBoundsException problem:Index 4 requested, with a size of 4

后端 未结 3 1443
走了就别回头了
走了就别回头了 2021-01-24 05:02

I want to display for each maker an AlertDialog that has some description, for that, i\'m using this code:

protected boolean onTap(int index) {
            db =          


        
3条回答
  •  清歌不尽
    2021-01-24 05:52

    just after calling
    Cursor cur = db.query(true, TABLE_COORD, result_columns, null, null, null, null, null, null);

    your cursor will be at -1 position and this exception will come if you fetch data when cursor is on -1 index.
    when you are calling cur.moveToPosition(index-1); for the first time your index value may be 0 that is the issue.

提交回复
热议问题