Last active
May 31, 2021 20:10
-
-
Save ericntd/dc6be17eb3499945e4403a7e8e430df7 to your computer and use it in GitHub Desktop.
Typical Room RxJava read stream and presentation of data
This file contains hidden or 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
schoolDAO.getData() // Flowable | |
.subscribeOn(schedulerProvider.io()) | |
.doOnSubscribe { showProgressSpinner() } | |
.flatMapSingle { school -> getExtraData(school) } | |
.observeOn(schedulerProvider.ui()) | |
.subscribe({ data -> | |
hideProgressSpinner() | |
updateUi(data) | |
}, { throwable -> | |
hideProgressSpinner() | |
handleError(throwable) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment