Looper.myLooper().quit() 报 NullPointerException
2015-11-10 22:44
537 查看
在调用 Looper.myLooper().quit() 的时候发现报 NullPointerException,通过 Android Studio 发现如下提示:
查阅了 Looper 的源码:
原来我在另外的线程间接地调用了
Looper.myLooper().quit() 方法。通过 Handler 发送 QUIT 消息解决此问题。
查阅了 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 消息解决此问题。
相关文章推荐
- 进击的KFC:UI(一)UIView及其子类
- 爬爬爬之路:UI(一) UIView UILabel
- [TwistedFate]UIView UILabel
- UI学习第一天UIView 和UILabel
- hdu1159 Common Subsequence (最长公共子序列)
- 我的iOS学习历程 - UIView和UILabel
- 我的iOS学习历程 - UIView和UILabel
- 新手学EasyUI(七)----DataGrid CheckBox 动态选中
- UI第一天UIView
- UI基础知识 -- UIView UILabel
- UI基础-UIView及其子类
- 小技巧9-iOS UITextField结束编辑、收回键盘
- 随意细解:UI -- UIView及其子类
- UITextField 用法
- UI第一天:UIView及其⼦类
- poj1904King's Quest【SCC tarjan解决配对问题】
- UISearchController的简单用法
- Windows/MFC_三个退出程序消息:WM_CLOSE、WM_DESTROY、WM_QUIT
- __cpuid, __cpuidex
- Lucene5.3.1最新版Query测试