[英]Accessing Android UI toolkit from worker thread
According to Android doc, "...Additionally, the Andoid UI toolkit is not thread-safe. So, you must not manipulate your UI from a worker thread—you must do all manipulation to your user interface from the UI thread. Thus, there are simply two rules to Android's single thread model: 根据Android文档,“ ...此外,Andoid UI工具包也不是线程安全的。因此,您不能从辅助线程中操作UI,而必须从UI线程对用户界面进行所有操作。因此, Android的单线程模型只有两个规则:
Do not block the UI thread Do not access the Android UI toolkit from outside the UI thread" 不要阻止UI线程不要从UI线程外部访问Android UI工具包”
That seems very plausible, but is it correct that the compiler does NOT complain at all if a programmer violates the second rule? 这似乎很合理,但是如果程序员违反了第二条规则,那么编译器根本不会抱怨是正确的吗?
Thank you. 谢谢。
You will not get a compile-time error. 您不会收到编译时错误。 You may (or may not) get a run-time error.
您可能会(或可能不会)收到运行时错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.