Using room in android for database. When I tried to see the data in sqlviewer then no tables found in database file Myapp.db file is empty. Data/data/packageName/databases/M
Make sure your database is closed when you exit your app, which will ensure that all outstanding transactions are committed:
@Override
protected void onDestroy() {
super.onDestroy();
// close the primary database to ensure all the transactions are merged
MyAppDatabase.getInstance(getApplicationContext()).close();
}
Then you can copy the database off your device using the Device File Explorer in Android Studio (look under /data/data/
You are also able to force a WAL checkpoint instead of closing the database, but in my humble opinion this option is easier (unless you are trying to backup your database within the app programmatically or something like that) and closing databases is a good idea (even if it's not really mentioned in the Android Room documentation).
Read more about sqlite WAL here: https://www.sqlite.org/wal.html