/** * Close assets database * * @param dbfile, the assets file which will be closed soon * @return, the status of this operating */ public boolean closeDatabase(String dbfile) { if (databases.get(dbfile) != null) { SQLiteDatabase db = (SQLiteDatabase) databases.get(dbfile); db.close(); databases.remove(dbfile); return true; } return false; }
/** Close all assets database */ public static void closeAllDatabase() { if (SQLiteDebug.isDebug) { Log.i(TAG, "closeAllDatabase"); } if (mInstance != null) { Set<String> set = mInstance.databases.keySet(); Iterator<String> iterator = set.iterator(); while (iterator.hasNext()) { String key = iterator.next(); SQLiteDatabase db = mInstance.databases.get(key); if (db.isOpen()) { db.close(); } iterator.remove(); } } }