Skip to content

Instantly share code, notes, and snippets.

@husaynhakeem
Created September 27, 2017 14:49
Show Gist options
  • Save husaynhakeem/8585f040f35628733790825a67b83b32 to your computer and use it in GitHub Desktop.
Save husaynhakeem/8585f040f35628733790825a67b83b32 to your computer and use it in GitHub Desktop.
public void populateDB() {
Completable.fromAction(() -> PokemonDataBase.getInstance(context).pokemonDao().insert(pokemonList()))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::onDBPopulationSuccess, this::onDBPopulationFailure);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment