android.database.CursorWindowAllocationException - 游标已关闭

时间:2015-11-25 19:28:19

标签: android android-sqlite android-cursor

数据库游标抛出异常,表示游标已打开,每次都关闭。返回声明搞砸了吗?

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) 

0 个答案:

没有答案