Last active
August 9, 2018 17:14
-
-
Save anandwana001/ab8deb6ed32ccb850b0d2b562b25bd92 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 = {Habit.class}, version = 1) | |
public abstract class HabitRoomDatabase extends RoomDatabase{ | |
public abstract HabitDao wordDao(); | |
//SINGLETON | |
private static HabitRoomDatabase INSTANCE; | |
static HabitRoomDatabase getDatabase(final Context context) { | |
if (INSTANCE == null) { | |
synchronized (HabitRoomDatabase.class) { | |
if (INSTANCE == null) { | |
INSTANCE = Room.databaseBuilder(context.getApplicationContext(), | |
HabitRoomDatabase.class, "habit_database") | |
.build(); | |
} | |
} | |
} | |
return INSTANCE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment