使用okhttp请求网络数据遇到这种错误,错误信息如下

Can't create handler inside thread that has not called Looper.prepare()

原因是你使用的是隐式开启新线程“ client.newCall(request).enqueue(callback);”
这句话的报错其实等同于“你不能在子线程中修改UI线程的界面”

解决办法很简单:

Can't create handler inside thread that has not called Looper.prepare()

相关文章:

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