java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()错误
今日搞个appwidget,因为要判断wifi和蓝牙状态,这些都是需要一定时间进行过程状态改变,所以要开线程来判断然后更新界面。
直接开了个线程在线程调用更新函数,可惜第一次点击添加appwidget的时候提示错误
java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
于是改用Handler就解决了。在appwidget里也可以这样干,太方便了。