美文网首页
遍历Cursor的正确方法

遍历Cursor的正确方法

作者: 穷格万物 | 来源:发表于2021-07-06 16:49 被阅读0次

    遍历cursor

     if (cursor != null && cursor.moveToFirst()) {
             do {
                 ...
                String name = cursor.getString(cursor.getColumnIndex("NAME"));
             } while (cursor.moveToNext());
     }
    

    关闭cursor

    if (cursor != null) {
            cursor.close();
     }
    

    相关文章

      网友评论

          本文标题:遍历Cursor的正确方法

          本文链接:https://www.haomeiwen.com/subject/fnvgultx.html