+
+ public void saveDomain(int databaseId, String domainName, boolean javaScriptEnabled, boolean firstPartyCookiesEnabled, boolean thirdPartyCookiesEnabled, boolean domStorageEnabled, boolean formDataEnabled, String userAgent, int fontSize,
+ int displayImages) {
+ // Store the domain data in a `ContentValues`.
+ ContentValues domainContentValues = new ContentValues();
+
+ // Add entries for each field in the database.
+ domainContentValues.put(DOMAIN_NAME, domainName);
+ domainContentValues.put(ENABLE_JAVASCRIPT, javaScriptEnabled);
+ domainContentValues.put(ENABLE_FIRST_PARTY_COOKIES, firstPartyCookiesEnabled);
+ domainContentValues.put(ENABLE_THIRD_PARTY_COOKIES, thirdPartyCookiesEnabled);
+ domainContentValues.put(ENABLE_DOM_STORAGE, domStorageEnabled);
+ domainContentValues.put(ENABLE_FORM_DATA, formDataEnabled);
+ domainContentValues.put(USER_AGENT, userAgent);
+ domainContentValues.put(FONT_SIZE, fontSize);
+ domainContentValues.put(DISPLAY_IMAGES, displayImages);
+
+ // Get a writable database handle.
+ SQLiteDatabase domainsDatabase = this.getWritableDatabase();
+
+ // Update the row for `databaseId`. The last argument is `null` because there are no `whereArgs`.
+ domainsDatabase.update(DOMAINS_TABLE, domainContentValues, _ID + " = " + databaseId, null);
+
+ // Close the database handle.
+ domainsDatabase.close();
+ }
+
+ public void deleteDomain(int databaseId) {
+ // Get a writable database handle.
+ SQLiteDatabase domainsDatabase = this.getWritableDatabase();
+
+ // Delete the row for `databaseId`. The last argument is `null` because we don't need additional parameters.
+ domainsDatabase.delete(DOMAINS_TABLE, _ID + " = " + databaseId, null);
+
+ // Close the database handle.
+ domainsDatabase.close();
+ }
+}
\ No newline at end of file