Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Disposing on Android 2.kt
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