为什么只能在Android的UI线程更新UI? [英] Why can only the UI thread in Android update the UI?

查看:138
本文介绍了为什么只能在Android的UI线程更新UI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能有人请向我解释,为什么只有在Android的UI线程可以更新用户界面? 为什么不能对任何其他线程更新UI?

Could someone please explain to me why only the UI thread in Android can update the UI? Why can't any other thread update the UI?

推荐答案

文档指出,Android的UI工具包没有线程安全。因此,单线程模式确保UI不是通过不同的线程的同时修改。

Documentation states that Android UI toolkit is not thread-safe. Thus, single thread model ensures UI is not modified by different threads at the same time.

这篇关于为什么只能在Android的UI线程更新UI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆