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

stkent

10/22/2019, 2:15 PM
s

streetsofboston

10/22/2019, 2:17 PM
In onCreate, do a
async
instead of a
launch
. Remember the returned
Deferred<T>
. Then in the onResume, do an
await()
on that
Deferred<T>
.
This is a dirty/statefull way of doing this. Another cleaner (in my opinion) way is to use a Channel or a Mutex (Mutex from Coroutines)
s

stkent

10/22/2019, 2:20 PM
Thanks @streetsofboston, those are some good pointers! I might go with the
async
to get through a deadline but will investigate the alternatives more when I have time!
Update: I went with a channel and it works great!
💯 1
3 Views