anko
anko copied to clipboard
await() is not found in 0.10.5
I am using 0.10.5 version on in my app.
I would like to do things in Coroutine in different thread till it gets it out come.
val compleated = false val needoOutcome = doAsync{ }
I need to await() till doAsync gets completed.
Please let me know what is the equivalent method for awai()
Please make sure you call await()
inside a coroutine
, because it needs to suspend until the computation finishes, and only coroutines can suspend in a non-blocking way.
As a matter of fact, doAsync returns a Future
object, if you don't want to use coroutine, you can hook it up with RxJava, see this.