协程线程问题
2020-05-23 本文已影响0人
威风堂堂堂
情况一
lifecycleScope.launch(Dispatchers.IO){
delay(5000)
click.text ="点点我"
}
情况二
lifecycleScope.launch(Dispatchers.IO){
click.text ="点点我"
}
情况一会crash(android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.),情况二不会,这是为什么?