遍历Cursor的正确方法

遍历cursor

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

关闭cursor

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

你可能感兴趣的:(遍历Cursor的正确方法)