So, I'm kind of confused right now.
I have a small Android App that is using Kotlin Coroutines. I know we have different scopes where we can run our coroutines, and I thought an app would crash if we try to update our UI while we're on the IO scope. Normally, on this scenario, this runtime exception would be shown:
android.util.AndroidRuntimeException: Animators may only be run on Looper threads
Weirdly enough, this doesn't happen on my app when I update the text of a textview. Here's an example of what I mean:
fun myFunction() {
CoroutineScope(Dispatchers.IO).launch {
textView.text = "Hello" // This should throw an exception, right? But it doesn't
inputLayout.editText!!.text.clear() // This DOES throw an exception tho
}
}
Could you help me understanding why does textView.text = "Hello" not throw an exception? Am I miss-understanding some basic coroutines concepts?
Thanks!