赞
踩
关于CursorWindowAllocatoinException有很多关于SO的问题:
他们都建议游标在使用后必须关闭.但这并没有解决我的问题.这是我的代码:
String query = "select serial from tbl1 union select serial from tbl2 union select serial from tbl3";
sqliteDatabase db = null;
Cursor cur = null;
try {
SettingsDatabaseHelper dal = new SettingsDatabaseHelper(
c);
db = dal.getReadableDatabase();
cur = db.rawQuery(query,null);
int numRows = cur.getCount();
if (numRows > 0) {
cur.moveToFirst();
int serialIdx = cur.getColumnIndexOrThrow("serial");
for (boolean hasItem = cur.moveToFirst(); hasItem; hasItem = cur
.moveToNext()) {
String serial = cur.getString(serialIdx);
if (Validator.getInstance().isValidSerial(serial))
serials.add(serial);
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。