Cursor cursor=null;
Cursor cursor2=null;
db = helper.getReadableDatabase();
try{
cursor=rawQuery("...",null);
while (cursor.moveToNext())
{
// ...
cursor2=db.rawQuery("select file_path from memos where time > "+date+" and time < "+lg+" order by time desc",null);
if(cursor2.moveToNext()){
//...
}
cursor2.close(); // 因是在循环内,要在此处加上关闭,而不仅只在finally中关闭
// ...
}
}
}finally{
if(cursor!=null){
cursor.close();
}
if(cursor2!=null){
cursor2.close();
}
db.close(); // 此处可以根据情况关闭与否
}