dave08
11/04/2020, 1:37 PMViewModel
using launchIn
on a `Fragment`'s lifecycleScope
can I assume that the UI won't get updated if the activity is detached or the state is paused? And if not, then do I have to register all these things on onResume
and cancel them on onPause
or check before updating each time?Hakob Astvacatryan
11/04/2020, 6:20 PMlaunchWhenCreated, launchWhenStarted, launchWhenResumed
builder functions that you can use to launch coroutines. They all lifecycle aware.dave08
11/05/2020, 2:54 AMHakob Astvacatryan
11/05/2020, 9:09 AMlaunchWhenResumed
in case of start launchWhenStarted
Hakob Astvacatryan
11/05/2020, 10:01 AMdave08
11/05/2020, 10:35 AMsomeFlow().launchIn(...?)
// Or do I need to do this:
lifecycleScope.launchWhenResumed {
someFlow.collect { }
}
Hakob Astvacatryan
11/05/2020, 10:40 AMHakob Astvacatryan
11/05/2020, 10:40 AMdave08
11/05/2020, 10:42 AM