WorieN
WorieN

Reputation: 1296

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();
}

Upvotes: 8

Views: 3306

Answers (1)

WorieN
WorieN

Reputation: 1296

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.

Upvotes: 8

Related Questions