- E/AndroidRuntime(26639):Causedby:java.lang.RuntimeException:Can'tcreatehandlerinsidethreadthathasnotcalledLooper.prepare()
E/AndroidRuntime(26639): Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
在报错的方法前加Looper.prepare();
方法末尾加Looper.loop();
源地址:http://blog.youkuaiyun.com/changemyself/article/details/8121785
本文介绍了一种在Android开发中解决线程异常的方法。当在未调用Looper.prepare()的线程中创建Handler时,会引发RuntimeException。文章提供了解决方案,即在创建Handler之前调用Looper.prepare(),并在方法末尾调用Looper.loop()。
2015

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



