Created
February 5, 2022 15:19
-
-
Save 2tanayk/96db7e9217fbfe6c1cd4d1eb329787b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Database(entities = {SomeEntity.class}, version = 1) | |
public abstract class Database extends RoomDatabase { | |
private static Database instance; | |
public abstract SomeDao dao(); | |
public static synchronized NoteDatabase getInstance(Context context) { | |
if (instance == null) { | |
instance = Room.databaseBuilder(context.getApplicationContext(), Database.class, "database"). | |
fallbackToDestructiveMigration(). | |
.build(); | |
} | |
return instance; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment