From 807ddf5a6e595d2368579008bb8132296be54ea2 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Thu, 27 Dec 2018 13:54:19 +0800 Subject: Move several classes to other packages. --- .../SubscribedUserRoomDatabase.java | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 app/src/main/java/SubscribedUserDatabase/SubscribedUserRoomDatabase.java (limited to 'app/src/main/java/SubscribedUserDatabase/SubscribedUserRoomDatabase.java') diff --git a/app/src/main/java/SubscribedUserDatabase/SubscribedUserRoomDatabase.java b/app/src/main/java/SubscribedUserDatabase/SubscribedUserRoomDatabase.java new file mode 100644 index 00000000..cf3ea59d --- /dev/null +++ b/app/src/main/java/SubscribedUserDatabase/SubscribedUserRoomDatabase.java @@ -0,0 +1,26 @@ +package SubscribedUserDatabase; + +import android.arch.persistence.room.Database; +import android.arch.persistence.room.Room; +import android.arch.persistence.room.RoomDatabase; +import android.content.Context; + +@Database(entities = {SubscribedUserData.class}, version = 1) +public abstract class SubscribedUserRoomDatabase extends RoomDatabase { + private static SubscribedUserRoomDatabase INSTANCE; + + public abstract SubscribedUserDao subscribedUserDao(); + + public static SubscribedUserRoomDatabase getDatabase(final Context context) { + if(INSTANCE == null) { + synchronized (SubscribedUserRoomDatabase.class) { + if(INSTANCE == null) { + INSTANCE = Room.databaseBuilder(context.getApplicationContext(), + SubscribedUserRoomDatabase.class, "subscribed_users") + .build(); + } + } + } + return INSTANCE; + } +} -- cgit v1.2.3