Created
May 19, 2017 08:29
-
-
Save tunitowen/f477e192185743bd1aa5c70eaf34d226 to your computer and use it in GitHub Desktop.
Room-GettingStarted-AddData
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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