Created
September 30, 2018 12:32
-
-
Save sellmair/e86f678ee3868c41fe1ff3d6dfb434c9 to your computer and use it in GitHub Desktop.
Disposing on Android 2.kt
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
class MyActivity: AppCompatActivity() { | |
private val lifecycleProvider = AndroidLifecycle.createLifecycleProvider(::getLifecycle) | |
fun onCreate() { | |
super.onCreate() | |
fetchData() | |
.flatMap(::prepareData) | |
.compose(lifecycleProvider.bindToLifecycle()) | |
.subscribe(::displayData) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment