亚洲城娱乐安卓数据库内存溢出

( 亚洲城娱乐 )

Cursor window allocation of 2048 kb failed.数据库开了一段时间就报这个问题。
代码如下:

            try {
            cursor = db.rawQuery("SELECT * FROM ClassList", null);
            if (cursor.moveToFirst()) {
                do {
                    AllDataModel.DataBean.ClassListBean classItem = new AllDataModel.DataBean.ClassListBean();
                    classItem.setId(cursor.getString(cursor.getColumnIndex("cid")));
                    classItem.setName(cursor.getString(cursor.getColumnIndex("name")));
                    classItem.setClassroom_id(cursor.getString(cursor.getColumnIndex("classroom_id")));
                    classList.add(classItem);
                } while (cursor.moveToNext());
            }
        } catch (Exception e) {
            Log.e("loadClassList", e.getMessage());
        } finally {
            if (cursor != null) {
                cursor.close();
            }
        }
        
        
        数据库使用了单例模式:
         public synchronized static SignDataBase getInstance(Context context){
    if (signDataBase == null){
        signDataBase = new SignDataBase(context);
    }
    return signDataBase;
}

(看完/读完)这篇文章有何感想! 亚洲城娱乐的分享…

发表评论

电子邮件地址不会被公开。 必填项已用*标注