I\'d like to use Room with a pre-populated database, but I can\'t understand how to tell Room where to find my database.
I\'ve now put it in src/main/assets/da
Room now supports Prepopulated Databases just prepare your database by using any programs like SQLite Browser or any. Then put it in Assets Folder probably in a subfolder called database then call:
Room.databaseBuilder(appContext, AppDatabase.class, "Sample.db")
.createFromAsset("database/myapp.db")
.build()
If you did not provide your database as an Asset but you downloaded it or it is in File System then then the method is:
Room.databaseBuilder(appContext, AppDatabase.class, "Sample.db")
.createFromFile(File("mypath"))
.build()
For more description or database migrations about this Feature you can check the Documentation Training.