Closing the SQLiteDatabase in a Content Provider
问题 I'm looking through the NotePad example that comes with the Android SDK and I was wondering if someone could clarify why the the variable db is never closed in the update function? It's usually a good idea to close the database when it is no longer in use to prevent leaks. Ideas? @Override public int update(Uri uri, ContentValues values, String where, String[] whereArgs) { // Opens the database object in "write" mode. SQLiteDatabase db = mOpenHelper.getWritableDatabase(); ... // More code, db