https://kotlinlang.org logo
#coroutines
Title
# coroutines
l

louiscad

02/10/2018, 4:38 PM
@luciofm I was thinking about cancelling the job when the lifecycle state is no longer valid, e.g. cancel
onResume()
coroutine when
onPause()
is called.
🧵 1
l

luciofm

02/10/2018, 4:40 PM
You would also need to check inside the coroutines for
isActive
l

louiscad

02/10/2018, 4:41 PM
@luciofm No need if the suspending methods already handle cancellation
@elizarov @luciofm The main use case I'm thinking of right now is getting Preferences off the UI thread since first load hits storage blocking, and when it's done, continue creating the UI, taking into account the values from the Preferences. I'd do the same if I needed to use some SDK who's first access blocks the calling thread
6 Views