首页 > 其他 > 详细

Looper.myLooper().quit() 报 NullPointerException

时间:2015-11-11 00:01:16      阅读:611      评论:0      收藏:0      [点我收藏+]

在调用 Looper.myLooper().quit()  的时候发现报 NullPointerException,通过 Android Studio 发现如下提示:

技术分享

查阅了 Looper 的源码:

    /**
     * Return the Looper object associated with the current thread.  Returns
     * null if the calling thread is not associated with a Looper.
     */
    public static @Nullable Looper myLooper() {
        return sThreadLocal.get();
    }



原来我在另外的线程间接地调用了  Looper.myLooper().quit() 方法。通过 Handler 发送 QUIT 消息解决此问题。

Looper.myLooper().quit() 报 NullPointerException

原文:http://my.oschina.net/jerikc/blog/528701

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!