Skip to content

Instantly share code, notes, and snippets.

@sellmair
Created September 30, 2018 12:32
Show Gist options
  • Save sellmair/e86f678ee3868c41fe1ff3d6dfb434c9 to your computer and use it in GitHub Desktop.
Save sellmair/e86f678ee3868c41fe1ff3d6dfb434c9 to your computer and use it in GitHub Desktop.
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