public class DatabaseOpenHelper
extends android.database.sqlite.SQLiteOpenHelper
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Class<?>[] |
tables
The tables of the database to create in
onCreate(SQLiteDatabase). |
| Modifier | Constructor and Description |
|---|---|
protected |
DatabaseOpenHelper(android.content.Context context,
java.lang.String name,
int version,
java.lang.Class<?>... tables)
Creates a new instance of
DatabaseOpenHelper by invoking
its super-class SQLiteOpenHelper, and optionally stores
the given tables for database table creation when onCreate(SQLiteDatabase) is called. |
| Modifier and Type | Method and Description |
|---|---|
static DatabaseOpenHelper |
newInstance(android.content.Context context,
java.lang.Class<?>... tables)
Creates a new instance of
DatabaseOpenHelper. |
static DatabaseOpenHelper |
newInstance(android.content.Context context,
int version,
java.lang.Class<?>... tables)
Creates a new instance of
DatabaseOpenHelper with the given version. |
static DatabaseOpenHelper |
newInstance(android.content.Context context,
java.lang.String name,
java.lang.Class<?>... tables)
Creates a new instance of
DatabaseOpenHelper with the given name. |
static DatabaseOpenHelper |
newInstance(android.content.Context context,
java.lang.String name,
int version,
java.lang.Class<?>... tables)
|
void |
onCreate(android.database.sqlite.SQLiteDatabase database) |
void |
onUpgrade(android.database.sqlite.SQLiteDatabase database,
int oldVersion,
int newVersion) |
protected final java.lang.Class<?>[] tables
onCreate(SQLiteDatabase).protected DatabaseOpenHelper(android.content.Context context,
java.lang.String name,
int version,
java.lang.Class<?>... tables)
DatabaseOpenHelper by invoking
its super-class SQLiteOpenHelper, and optionally stores
the given tables for database table creation when onCreate(SQLiteDatabase) is called.context - the context to use to open or create the databasename - the file name of the database file, or null for an in-memory databaseversion - the version number of the database (starting at 1); if the database is older,
onUpgrade(SQLiteDatabase, int, int) will be used to upgrade the database;
if the database is newer, SQLiteOpenHelper.onDowngrade(SQLiteDatabase, int, int) will be used to downgrade the databasetables - the tables of the database to create in onCreate(SQLiteDatabase).
For subsequent call, tables can be null.public static DatabaseOpenHelper newInstance(android.content.Context context, java.lang.String name, int version, java.lang.Class<?>... tables)
context - the context to use to open or create the databasename - the file name of the database file, or null for an in-memory databaseversion - the version number of the database (starting at 1); if the database is older,
onUpgrade(SQLiteDatabase, int, int) will be used to upgrade the database;
if the database is newer, SQLiteOpenHelper.onDowngrade(SQLiteDatabase, int, int) will be used to downgrade the databasetables - the tables of the database to create in onCreate(SQLiteDatabase).
For subsequent call, tables can be null.public static DatabaseOpenHelper newInstance(android.content.Context context, int version, java.lang.Class<?>... tables)
DatabaseOpenHelper with the given version.
The application package name will be used as the name of the database.
context - the context to use to open or create the databaseversion - the version number of the database (starting at 1); if the database is older,
onUpgrade(SQLiteDatabase, int, int) will be used to upgrade the database;
if the database is newer, SQLiteOpenHelper.onDowngrade(SQLiteDatabase, int, int) will be used to downgrade the databasetables - the tables of the database to create in onCreate(SQLiteDatabase).
For subsequent call, tables can be null.public static DatabaseOpenHelper newInstance(android.content.Context context, java.lang.String name, java.lang.Class<?>... tables)
DatabaseOpenHelper with the given name.
The application version code will be used as the database version.
context - the context to use to open or create the databasename - the file name of the database file, or null for an in-memory databasetables - the tables of the database to create in onCreate(SQLiteDatabase).
For subsequent call, tables can be null.public static DatabaseOpenHelper newInstance(android.content.Context context, java.lang.Class<?>... tables)
DatabaseOpenHelper.
The application package name and version code will be used as the name and version of the database respectively.
context - the context to use to open or create the databasetables - the tables of the database to create in onCreate(SQLiteDatabase).
For subsequent call, tables can be null.public void onCreate(android.database.sqlite.SQLiteDatabase database)
onCreate in class android.database.sqlite.SQLiteOpenHelperpublic void onUpgrade(android.database.sqlite.SQLiteDatabase database,
int oldVersion,
int newVersion)
onUpgrade in class android.database.sqlite.SQLiteOpenHelper