Compartilhar via


Context.OpenOrCreateDatabase Method

Definition

Overloads

OpenOrCreateDatabase(String, FileCreationMode, SQLiteDatabase+ICursorFactory)

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

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

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

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);
[<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")>]
abstract member OpenOrCreateDatabase : string * Android.Content.FileCreationMode * Android.Database.Sqlite.SQLiteDatabase.ICursorFactory -> Android.Database.Sqlite.SQLiteDatabase

Parameters

name
String

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

mode
FileCreationMode

Operating mode.

factory
SQLiteDatabase.ICursorFactory

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

Returns

The contents of a newly created database with the given name.

Attributes

Exceptions

if the database file could not be opened.

Remarks

Java documentation for android.content.Context.openOrCreateDatabase(java.lang.String, int, android.database.sqlite.CursorFactory).

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

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")]
public abstract Android.Database.Sqlite.SQLiteDatabase? OpenOrCreateDatabase (string? name, Android.Content.FileCreationMode mode, Android.Database.Sqlite.SQLiteDatabase.ICursorFactory? factory, Android.Database.IDatabaseErrorHandler? errorHandler);
[<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")>]
abstract member OpenOrCreateDatabase : string * Android.Content.FileCreationMode * Android.Database.Sqlite.SQLiteDatabase.ICursorFactory * Android.Database.IDatabaseErrorHandler -> Android.Database.Sqlite.SQLiteDatabase

Parameters

name
String

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

mode
FileCreationMode

Operating mode.

factory
SQLiteDatabase.ICursorFactory

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

errorHandler
IDatabaseErrorHandler

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

Returns

The contents of a newly created database with the given name.

Attributes

Exceptions

if the database file could not be opened.

Remarks

Java documentation for android.content.Context.openOrCreateDatabase(java.lang.String, int, android.database.sqlite.CursorFactory).

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