68.5 Adding the Room Database
The last task before adding the repository to the project is to implement the Room Database instance. Add a new class to the project named ProductRoomDatabase, this time with the Class option selected.
Once the file has been generated, modify it as follows using the steps outlined in the “The Android Room Persistence Library” chapter:
package com.ebookfrenzy.roomdemo;
import android.content.Context;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;
@Database(entities = {Product.class}, version = 1)
public abstract class ProductRoomDatabase extends RoomDatabase {
public abstract ProductDao productDao();
private static ProductRoomDatabase INSTANCE;
static ProductRoomDatabase getDatabase(final Context context) {
&...