prepopulating a database not working in android

I need to prepopulate a database table using

Room.databaseBuilder(appContext, AppDatabase.class, "Sample.db")     .createFromAsset("database/myapp.db")     .build() 

for doing this I have created a myapp.db from DB Browser for SQLite

have kept file inside assets/database folder, but it’s running successfully without any error and no data is available offline. why it’s not giving any error? I tried changing the asset path in function but still, neither any error nor any local database is coming

when I am opening .db file in DB Browser for SQLite, it is opening correctly Please help

Asked on July 16, 2020 in Java.
Add Comment
1 Answer(s)

I was able to solve the above problem by reinstalling the application, and it also returns a database instance so I was using different instance for the querying database.

Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.