Dialog中使用handler时报:Can't create handler inside thread that has not called Looper.prepare()

来源:互联网 发布:手机音频合成软件 编辑:程序博客网 时间:2024/04/30 02:18

Dialog中使用handler时报:Can't create handler inside thread that has not called Looper.prepare()

dialog的show方法前后加,Looper.prepare();和Looper.loop();即可

但这样会扰乱 Looper的运行机制,在主线程中就不行在使用handler了

建议用其他方式代替Dialog中的handler。


1 0
原创粉丝点击