遍历Cursor的正确方法
2021-07-06 本文已影响0人
穷格万物
遍历cursor
if (cursor != null && cursor.moveToFirst()) {
do {
...
String name = cursor.getString(cursor.getColumnIndex("NAME"));
} while (cursor.moveToNext());
}
关闭cursor
if (cursor != null) {
cursor.close();
}