summaryrefslogtreecommitdiffstats
path: root/core/java/android/content/Context.java
diff options
context:
space:
mode:
authorVasu Nori <vnori@google.com>2010-06-03 12:42:32 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-06-03 12:42:32 -0700
commit512596d4254cb15ad329e3b78f3c867bd65208ca (patch)
tree22d16b6ac3a67acf5cd4d1f577af4c605d3191d4 /core/java/android/content/Context.java
parentf8b0f11a94b10f38d16afbf4364243e9dbd4e2fd (diff)
parent74f170f9468d3cf6d7d0ef453320141a3e63571b (diff)
downloadframeworks_base-512596d4254cb15ad329e3b78f3c867bd65208ca.zip
frameworks_base-512596d4254cb15ad329e3b78f3c867bd65208ca.tar.gz
frameworks_base-512596d4254cb15ad329e3b78f3c867bd65208ca.tar.bz2
Merge "new API in Context. on openDatabase, new param DatabaseErrorHandler"
Diffstat (limited to 'core/java/android/content/Context.java')
-rw-r--r--core/java/android/content/Context.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 0afd6d2..0615267 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -21,6 +21,8 @@ import android.content.pm.PackageManager;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.content.res.TypedArray;
+import android.database.DatabaseErrorHandler;
+import android.database.DefaultDatabaseErrorHandler;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.graphics.Bitmap;
@@ -588,6 +590,32 @@ public abstract class Context {
int mode, CursorFactory factory);
/**
+ * Open a new private SQLiteDatabase associated with this Context's
+ * application package. Creates the database file if it doesn't exist.
+ *
+ * <p>Accepts input param: a concrete instance of {@link DatabaseErrorHandler} to be
+ * used to handle corruption when sqlite reports database corruption.</p>
+ *
+ * @param name The name (unique in the application package) of the database.
+ * @param mode Operating mode. Use 0 or {@link #MODE_PRIVATE} for the
+ * default operation, {@link #MODE_WORLD_READABLE}
+ * and {@link #MODE_WORLD_WRITEABLE} to control permissions.
+ * @param factory An optional factory class that is called to instantiate a
+ * cursor when query is called.
+ * @param errorHandler the {@link DatabaseErrorHandler} to be used when sqlite reports database
+ * corruption. if null, {@link DefaultDatabaseErrorHandler} is assumed.
+ * @return The contents of a newly created database with the given name.
+ * @throws android.database.sqlite.SQLiteException if the database file could not be opened.
+ *
+ * @see #MODE_PRIVATE
+ * @see #MODE_WORLD_READABLE
+ * @see #MODE_WORLD_WRITEABLE
+ * @see #deleteDatabase
+ */
+ public abstract SQLiteDatabase openOrCreateDatabase(String name,
+ int mode, CursorFactory factory, DatabaseErrorHandler errorHandler);
+
+ /**
* Delete an existing private SQLiteDatabase associated with this Context's
* application package.
*