数据库游标抛出异常,表示游标已打开,每次都关闭。返回声明搞砸了吗?
public long getValue() {
long val = 0;
Cursor cursor = null;
try {
if (db != null) {
cursor = db.query(*****);
if (cursor.moveToFirst()) {
return cursor.getLong(cursor.getColumnIndex(****));
}
}
} finally {
if (cursor != null) {
cursor.close();
}
}
return val;
}
获得以下例外:
android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed. # Open Cursors=1 (# cursors opened by this proc=1)