08-24 16:59:11.223: W/System.err(31649): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
在出错的语句前面加上下列判断
if (Looper.myLooper()==null) {
Looper.prepare();
}
在出错的语句前面加上下列判断
if (Looper.myLooper()==null) {
Looper.prepare();
}
本文解决了一个关于在未调用Looper.prepare()的情况下尝试创建Handler时出现的java.lang.RuntimeException异常。通过检查代码并在创建Handler前调用Looper.prepare()可以避免此异常。
3117

被折叠的 条评论
为什么被折叠?



