public abstract class DeviceDB
extends androidx.room.RoomDatabase
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
DATABASE_NAME |
private androidx.lifecycle.MutableLiveData<java.lang.Boolean> |
mIsDBCreated |
private static DeviceDB |
sInstance |
private static java.lang.String |
TAG |
Constructor and Description |
---|
DeviceDB() |
Modifier and Type | Method and Description |
---|---|
private static DeviceDB |
buildDatabase(android.app.Application app)
Build the database.
|
abstract DeviceDao |
deviceDao() |
androidx.lifecycle.LiveData<java.lang.Boolean> |
getDatabaseCreated() |
static DeviceDB |
INST(android.app.Application app) |
private void |
postDatabaseCreated() |
private void |
updateDatabaseCreated(android.content.Context context)
Check whether the database already exists and expose it via
getDatabaseCreated() |
assertNotMainThread, beginTransaction, clearAllTables, close, compileStatement, createInvalidationTracker, createOpenHelper, endTransaction, getInvalidationTracker, getOpenHelper, getQueryExecutor, init, internalInitInvalidationTracker, inTransaction, isOpen, query, query, runInTransaction, runInTransaction, setTransactionSuccessful
private static final java.lang.String TAG
private static final java.lang.String DATABASE_NAME
private static DeviceDB sInstance
private final androidx.lifecycle.MutableLiveData<java.lang.Boolean> mIsDBCreated
public static DeviceDB INST(android.app.Application app)
private static DeviceDB buildDatabase(android.app.Application app)
Builder#build()
only sets up the database
configuration and creates a new instance of the database.
The SQLite database is only created when it's accessed for the first time.public abstract DeviceDao deviceDao()
private void updateDatabaseCreated(android.content.Context context)
getDatabaseCreated()
public androidx.lifecycle.LiveData<java.lang.Boolean> getDatabaseCreated()
private void postDatabaseCreated()