今天在检查友盟提交反馈的时候发现一个bug:java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
经过检查发现,有9处调用,其他八处都是主线程,只有
new Timer().schedule(new TimerTask() { @Override public void run() { .... } }, 4000);
这里才会出问题, 原因在于Timer其实是一个线程,所以handler = new Handler(); 是错误的,必须加上
Looper.prepare();
... Looper.loop();