当我们在线程里面更新UI的时候会报错:Only the original thread that created a view hierarchy can touch its views.
如下面的代码:直接在UDP发送线程里面更新UI,就会报错,报错提示如下。
线程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.
这里的解决办法是把UI更新放到Handler里面。所以把上述代码的UI更新部分修改为如下图所示。

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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-18
  • 2022-01-09
  • 2021-07-12
  • 2022-12-23
  • 2022-02-07
  • 2022-12-23
相关资源
相似解决方案