线程UI更新报错:Only the original thread that created a view hierarchy can touch its views.

当我们在线程里面更新UI的时候会报错:Only the original thread that created a view hierarchy can touch its views. 如下面的代码:直接在UDP发送线程里面更新UI,就会报错,报错提示如下。 这里的解决办法是把UI更新放到Handler里面。所以把上述代码的UI更新部分修改为如下图所示。
相关文章
相关标签/搜索