https://kotlinlang.org logo
#android
Title
# android
s

stkent

10/22/2019, 2:14 PM
Has anyone dealt with "synchronizing" coroutines across Android lifecycle events? For example:
Copy code
onCreate(...) {
    scope.launch {
        asyncThing()
    }
}

onResume(...) {
    scope.launch {
        // code that depends on asyncThing() having completed
    }
}
Is there a way to "join" such that the onResume work does not start until the
asyncThing
is done?
k

kingsley

10/22/2019, 2:26 PM
Or perhaps just keep the result of the initial
scope.launch
and
join
it in onResume
s

stkent

10/22/2019, 2:31 PM
Thanks @kingsley 😄
👍 1
2 Views