我知道关闭数据库后,游标变为“无效”,这是否也会同时关闭游标?这是否避免了必须做如下所示的事情?
示例 1
public void String getResultsAndReturnString() {
String result = "";
SQLiteDatabase db = dbHelper.getReadableDatabase();
Cursor cursor = qb.query(db, projection, null, null,
null, null, null);
cursor.close(); <-- explicit cursor close example one
db.close();
return result;
}
示例 2
public void Cursor getResultsAndReturnCursor(){
SQLiteDatabase db = dbHelper.getReadableDatabase();
Cursor cursor = qb.query(db, projection, null, null,
null, null, null);
return cursor;
}
public void closeOut(Cursor cursor, SQLiteDatabase dataBase){
cursor.close(); <-- explicit cursor close example two
dataBase.close();
}