Skip to content

Instantly share code, notes, and snippets.

@Menris
Last active May 17, 2018 06:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Menris/c392032b1275d4fd49c8bdfcd8d12fa3 to your computer and use it in GitHub Desktop.
Save Menris/c392032b1275d4fd49c8bdfcd8d12fa3 to your computer and use it in GitHub Desktop.
Room.databaseBuilder(context, AppDatabase.class,
DB_NAME)
.allowMainThreadQueries()
.fallbackToDestructiveMigration()
.addCallback(new RoomDatabase.Callback() {
@Override
public void onCreate(@NonNull SupportSQLiteDatabase db) {
super.onCreate(db);
Executors.newSingleThreadExecutor().execute(() -> {
//заполнение базы
});
}
@Override
public void onOpen(@NonNull SupportSQLiteDatabase db) {
super.onOpen(db);
}
})
.build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment