为了使用Room,我们创建了一个抽象类来扩展
RoomDatabase
@Database(entities = {Note.class}, version = 1)
public abstract class NoteDatabase extends RoomDatabase {
private static NoteDatabase instance;
public abstract NoteDao noteDao();
public static synchronized NoteDatabase getInstance(Context context) {
if (instance == null) {
instance = Room.databaseBuilder(context.getApplicationContext(),
NoteDatabase.class, "note_database")
.fallbackToDestructiveMigration()
.addCallback(roomCallback)
.build();
}
return instance;
}
我知道Room为这个类生成了实现,但是我怎么可能得到
NoteDatabase