Can't create handler inside thread that has not called Looper.prepare()
来源:互联网 发布:如何网络人肉 编辑:程序博客网 时间:2024/06/14 04:47
E/AndroidRuntime: FATAL EXCEPTION: pool-4-thread-1 Process: PID: 3961//这里是因为在子线程中进行了startActivity() java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() at android.os.Handler.<init>(Handler.java:200) at android.os.Handler.<init>(Handler.java:114) at android.app.ActivityTransitionCoordinator.<init>(ActivityTransitionCoordinator.java:215) at android.app.ExitTransitionCoordinator.<init>(ExitTransitionCoordinator.java:75) at android.app.ActivityOptions.makeSceneTransitionAnimation(ActivityOptions.java:538) at com.hyphenate.chat.EMClient$6.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818) E/WindowManager: android.view.WindowLeaked: Activity LoginActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{b45027b V.E..... R......D 0,0-540,276} that was originally added here at android.view.ViewRootImpl.<init>(ViewRootImpl.java:382) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:271) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85) at android.app.Dialog.show(Dialog.java:310) at android.view.View.performClick(View.java:4785) at android.view.View$PerformClick.run(View.java:19884) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:147) at android.app.ActivityThread.main(ActivityThread.java:5513) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:970) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:765)
android.view.WindowLeaked: Activity LoginActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{b45027b V.E….. R……D 0,0-540,276} that was originally added here
原因是:在跳转activity时,dialog 弹窗未销毁。调用dismiss 或者是cancel。
java.lang.RuntimeException: Can’t create handler inside thread that has not called Looper.prepare()
这里是因为在子线程中进行了startActivity(),5.0以上就会crash
5.0以上 我的写法是:
startActivity(intent,ActivityOptions.makeSceneTransitionAnimation(activity).toBundle());
5.0以下, 我的写法是:
activity.startActivity(intent);
0 0
- 解决Can't create handler inside thread that has not called Looper.prepare() inside AsyncTask
- Handler——Can't create handler inside thread that has not called Looper.prepare()
- Handler机制和Can't create handler inside thread that has not called Looper.prepare()异常
- Can't create handler inside thread that has not called Looper.prepare()错误的解决
- Can't create handler inside thread that has not called Looper.prepare() 异常
- Can't create handler inside thread that has not called Looper.prepare()
- Can’t create handler inside thread that has not called Looper.prepare()
- Can’t create handler inside thread that has not called Looper.prepare()
- Can't create handler inside thread that has not called Looper.prepare()解决办法
- Can't create handler inside thread that has not called Looper.prepare() 终极解决方法
- 异常Can't create handler inside thread that has not called Looper.prepare() 解决方法
- Can't create handler inside thread that has not called Looper.prepare()错误的解决
- Can't create handler inside thread that has not called Looper.prepare() 终极解决方法
- Can't create handler inside thread that has not called Looper.prepare()
- Can't create handler inside thread that has not called Looper.prepare()的终极解决方法
- Can't create handler inside thread that has not called Looper.prepare()错误-安卓编程
- Can’t create handler inside thread that has not called Looper.prepare()
- Can't create handler inside thread that has not called Looper.prepare()解决办法
- 51nod 1534 棋子游戏
- HDU 4605 Magic Ball Game(可持续化线段树,树状数组,离散化)
- Android源码学习笔记:Handler机制
- vc++ api 双缓冲绘图
- 通过cmd命令行pip安装Python模块 ImportError: No module named XXX
- Can't create handler inside thread that has not called Looper.prepare()
- CentOS7 搭建影梭服务器
- 2016-11-28
- 【iOS_GitHub】引导页/首次安装引导页/渐变引导页/APP介绍页/新功能介绍页
- Codeforce 735C Tennis Championship(斐波那契数列)
- oop的理解
- Leetcode 263 Ugly Number
- python的logging日志模块(二)
- 苏嵌23 16.11.28