Skip to content

Instantly share code, notes, and snippets.

@tunitowen
Created May 19, 2017 08:29
Show Gist options
  • Save tunitowen/f477e192185743bd1aa5c70eaf34d226 to your computer and use it in GitHub Desktop.
Save tunitowen/f477e192185743bd1aa5c70eaf34d226 to your computer and use it in GitHub Desktop.
Room-GettingStarted-AddData
fun addPerson(firstName: String, lastName: String) {
val person = Person(0, firstName, lastName)
Single.fromCallable {
MyApp.database?.personDao()?.insert(person)
}.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()).subscribe()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment