Created
December 1, 2018 07:51
-
-
Save abdihaikal/bc61cb66e90f512127f878afb5308a1a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public abstract class AppDatabase extends RoomDatabase { | |
private static final String TAG = "AppDatabase"; | |
private static volatile AppDatabase INSTANCE; | |
public static AppDatabase getInstance(Context context) { | |
if (INSTANCE == null) { | |
synchronized (AppDatabase.class) { | |
if (INSTANCE == null) { | |
INSTANCE = Room.databaseBuilder(context.getApplicationContext(), AppDatabase.class, 'appdatabase.db').build(); | |
} | |
} | |
} | |
return INSTANCE; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment