elizarov
09/11/2017, 1:48 PMlaunch(EmptyCoroutineContext)
or launch(Unconfined)
in UI thread, then after the first async operation like delay
you’ll resume in some other thread and will not be in UI thread anymore. However, with launch(UI)
you always resume in UI thread, guaranteed. It is explained with examples in this section of the guide: https://github.com/Kotlin/kotlinx.coroutines/blob/master/coroutines-guide.md#unconfined-vs-confined-dispatcher