Android笔记:常见错误问题及解决方法汇总
1.Android java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() E/AndroidRuntime(7200):Uncaughthandler:threadThread-8exitingduetouncaughtexception E/AndroidRuntime(7200):java.lang.RuntimeException:Can'tcreatehandlerinsidethreadthathasnotcalledLooper.prepare() 原因是非主线程中默认没有创建Looper对象,需要先调用Looper.prepare()启用Looper。 解决方法: new Thread() { public void run() { Looper.prepare(); mPst.startPushService(); mPst.sendJson2Server(qJson);//上线发消息给server Looper.loop()...
