简体   繁体   中英

Why is there no database file created when using Android Room?

I use the Room Persistence Library for my Android app, but after it's creation I can not find .sql file with tables on my device.

When I create database through SQLiteOpenHelper I can see all my tables in folder data on the device, but when I create database through Room there is no file anywhere.

Where can I see the content of all my tables?

Create database code:

@Provides
@Singleton
PokuponDataBase providePokuponDataBase() {
    return Room.inMemoryDatabaseBuilder(SuperDealApp.getInstance().getApplicationContext(), PokuponDataBase.class, "PokuponRoomDatabase").build();
}

I found the cause of disappearing my database. It was because I create it incorrectly. I use Room.InMemoryDatabaseBuilder() instead of simple Room.databaseBuilder() and after each application reloading my db was recreated and also inMemory database does not create any files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM