Can't create handler inside thread that has not called Looper.prepare()

时间:2022-04-07 20:44:45

问题:使用了thread,asyncTask在其中使用了toast等更新ui

解决办法:1.使用handler来发送消息,在主线程中更新ui

       2.在报错的方法前加上Looper.prepare();   末尾加上Looper.loop();

 

 

REFERENCES:http://sdlqhjk.iteye.com/blog/1112204