使用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()

相关文章: