Possible Duplicate:
Android error - close() was never explicitly called on database如何避免
「關閉()從未被明確SQLiteDatabase呼籲數據庫」我已經在我的Android應用程序有問題。
我有一個單獨實現其與下面的代碼的方法:
public Cursor getFooCursor(Context context)
{
StorageDBOpenHelper helper = new StorageDBOpenHelper(context);
SQLiteDatabase db = helper.getReadableDatabase();
Cursor c = db.query("Foo", new String[] {"_id", "Titel"}, null, null, null, null, "Test DESC");
return c;
}
,當我用這個,我有時會收到錯誤:SQLiteDatabase: close() was never explicitly called on database
如何避免這種情況?問題是,我不能簡單地做一個db.close()
befor我return c
,因爲然後它的空。