IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    [原]Can\'t create handler inside thread that has not called Looper.prepare()错误的解决

    lincyang发表于 2011-07-07 18:18:29
    love 0

    此问题是和UI线程同步引起的。

    第一个办法是根据提示,添加 Looper.prepare(); 

     

    Thread action=newThread() { 

    publicvoidrun() {

     Looper.prepare(); 

     todo(); 

     Looper.loop(); } };

    action.start()

     

    第二个办法是用handler来处理。

    见另一篇文章:http://blog.csdn.net/lincyang/article/details/5861221



沪ICP备19023445号-2号
友情链接