RoomDatabase.Builder

public static class RoomDatabase.Builder
extends Object

java.lang.Object
   ↳ androidx.room.RoomDatabase.Builder<T extends androidx.room.RoomDatabase>


Builder for RoomDatabase.

Summary

Public methods

Builder<T> addAutoMigrationSpec(AutoMigrationSpec autoMigrationSpec)

Adds an auto migration spec to the builder.

Builder<T> addCallback(RoomDatabase.Callback callback)

Adds a RoomDatabase.Callback to this database.

Builder<T> addMigrations(Migration... migrations)

Adds a migration to the builder.

Builder<T> addTypeConverter(Object typeConverter)

Adds a type converter instance to this database.

Builder<T> allowMainThreadQueries()

Disables the main thread query check for Room.

T build()

Creates the databases and initializes it.

Builder<T> createFromAsset(String databaseFilePath, RoomDatabase.PrepackagedDatabaseCallback callback)

Configures Room to create and open the database using a pre-packaged database located in the application 'assets/' folder.

Builder<T> createFromAsset(String databaseFilePath)

Configures Room to create and open the database using a pre-packaged database located in the application 'assets/' folder.

Builder<T> createFromFile(File databaseFile)

Configures Room to create and open the database using a pre-packaged database file.

Builder<T> createFromFile(File databaseFile, RoomDatabase.PrepackagedDatabaseCallback callback)

Configures Room to create and open the database using a pre-packaged database file.

Builder<T> createFromInputStream(Callable<InputStream> inputStreamCallable, RoomDatabase.PrepackagedDatabaseCallback callback)

Configures Room to create and open the database using a pre-packaged database via an InputStream.

Build