www.yzc261.com安卓数据库内存溢出

( www.yzc261.com )

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;
}

(看完/读完)这篇文章有何感想! www.yzc261.com的分享…

发表评论

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