diff options
Diffstat (limited to 'app/src/main/java/Account/AccountRoomDatabase.java')
-rw-r--r-- | app/src/main/java/Account/AccountRoomDatabase.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/app/src/main/java/Account/AccountRoomDatabase.java b/app/src/main/java/Account/AccountRoomDatabase.java new file mode 100644 index 00000000..2f5d0120 --- /dev/null +++ b/app/src/main/java/Account/AccountRoomDatabase.java @@ -0,0 +1,27 @@ +package Account; + +import android.content.Context; + +import androidx.room.Database; +import androidx.room.Room; +import androidx.room.RoomDatabase; + +@Database(entities = {Account.class}, version = 1) +public abstract class AccountRoomDatabase extends RoomDatabase { + private static AccountRoomDatabase INSTANCE; + + public abstract AccountDao accountDao(); + + public static AccountRoomDatabase getDatabase(final Context context) { + if(INSTANCE == null) { + synchronized (AccountRoomDatabase.class) { + if(INSTANCE == null) { + INSTANCE = Room.databaseBuilder(context.getApplicationContext(), + AccountRoomDatabase.class, "accounts") + .build(); + } + } + } + return INSTANCE; + } +} |