Why this code updates UI inside IO context and don...
# coroutines
s
Why this code updates UI inside IO context and don't crash android app as expected?
Copy code
GlobalScope.launch(<http://Dispatchers.IO|Dispatchers.IO>) {
 textView.text = "New Text"
}
g
Maybe you override error handler. Actually I'm not 100% sure that setText actually has assert for UI thread, I believe some methods of view just silently fail without exception
l
I've also seen similar behaviour that first UI update on non-UI running coroutine passed, but further calls later on the same coroutine threw an Exception as expected. I was thinking that maybe coroutine starts so fast that in the beginning these asserts somehow don't notice the thread switch 😁
g
I think it's just related to how textview checks for main thread, not to coroutines itself