Context.OpenOrCreateDatabase Context.OpenOrCreateDatabase Method

Definition

Overloads

OpenOrCreateDatabase(String, FileCreationMode, SQLiteDatabase+ICursorFactory) OpenOrCreateDatabase(String, FileCreationMode, SQLiteDatabase+ICursorFactory)

Open a new private SQLiteDatabase associated with this Context's application package.

OpenOrCreateDatabase(String, FileCreationMode, SQLiteDatabase+ICursorFactory, IDatabaseErrorHandler) OpenOrCreateDatabase(String, FileCreationMode, SQLiteDatabase+ICursorFactory, IDatabaseErrorHandler)

Open a new private SQLiteDatabase associated with this Context's application package.

OpenOrCreateDatabase(String, FileCreationMode, SQLiteDatabase+ICursorFactory) OpenOrCreateDatabase(String, FileCreationMode, SQLiteDatabase+ICursorFactory)

Open a new private SQLiteDatabase associated with this Context's application package.

[Android.Runtime.Register("openOrCreateDatabase", "(Ljava/lang/String;ILandroid/database/sqlite/SQLiteDatabase$CursorFactory;)Landroid/database/sqlite/SQLiteDatabase;", "GetOpenOrCreateDatabase_Ljava_lang_String_ILandroid_database_sqlite_SQLiteDatabase_CursorFactory_Handler")]
public abstract Android.Database.Sqlite.SQLiteDatabase OpenOrCreateDatabase (string name, Android.Content.FileCreationMode mode, Android.Database.Sqlite.SQLiteDatabase.ICursorFactory factory);
abstract member OpenOrCreateDatabase : string * Android.Content.FileCreationMode * Android.Database.Sqlite.SQLiteDatabase.ICursorFactory -> Android.Database.Sqlite.SQLiteDatabase

Parameters

name
String String

The name (unique in the application package) of the database.

mode
FileCreationMode FileCreationMode

Operating mode. Use 0 or Private for the default operation, WorldReadable and WorldWriteable to control permissions. Use Android.Content.Context.MODE_ENABLE_WRITE_AHEAD_LOGGING to enable write-ahead logging by default.

factory
SQLiteDatabase.ICursorFactory SQLiteDatabase.ICursorFactory

An optional factory class that is called to instantiate a cursor when query is called.

Returns

Exceptions

if the database file could not be opened.

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

OpenOrCreateDatabase(String, FileCreationMode, SQLiteDatabase+ICursorFactory, IDatabaseErrorHandler) OpenOrCreateDatabase(String, FileCreationMode, SQLiteDatabase+ICursorFactory, IDatabaseErrorHandler)

Open a new private SQLiteDatabase associated with this Context's application package.

[Android.Runtime.Register("openOrCreateDatabase", "(Ljava/lang/String;ILandroid/database/sqlite/SQLiteDatabase$CursorFactory;Landroid/database/DatabaseErrorHandler;)Landroid/database/sqlite/SQLiteDatabase;", "GetOpenOrCreateDatabase_Ljava_lang_String_ILandroid_database_sqlite_SQLiteDatabase_CursorFactory_Landroid_database_DatabaseErrorHandler_Handler", ApiSince=11)]
public abstract Android.Database.Sqlite.SQLiteDatabase OpenOrCreateDatabase (string name, Android.Content.FileCreationMode mode, Android.Database.Sqlite.SQLiteDatabase.ICursorFactory factory, Android.Database.IDatabaseErrorHandler errorHandler);
abstract member OpenOrCreateDatabase : string * Android.Content.FileCreationMode * Android.Database.Sqlite.SQLiteDatabase.ICursorFactory * Android.Database.IDatabaseErrorHandler -> Android.Database.Sqlite.SQLiteDatabase

Parameters

name
String String

The name (unique in the application package) of the database.

mode
FileCreationMode FileCreationMode

Operating mode. Use 0 or Private for the default operation, WorldReadable and WorldWriteable to control permissions. Use Android.Content.Context.MODE_ENABLE_WRITE_AHEAD_LOGGING to enable write-ahead logging by default.

factory
SQLiteDatabase.ICursorFactory SQLiteDatabase.ICursorFactory

An optional factory class that is called to instantiate a cursor when query is called.

errorHandler
IDatabaseErrorHandler IDatabaseErrorHandler

the IDatabaseErrorHandler to be used when sqlite reports database corruption. if null, DefaultDatabaseErrorHandler is assumed.

Returns

Exceptions

if the database file could not be opened.

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

Applies to