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

来源:互联网 发布:4g移动网络接入点设置 编辑:程序博客网 时间:2024/06/04 01:03
 出现 

Can't create handler inside thread that has not called Looper.prepare() 的原因是没在主线程 实例化new Handler(),如果在非主线程实例化可以


Looper.prepare(); Handler handler = new Handler();Looper.loop();或者Handler handler = new Handler(Looper.getMainLooper());
0 0