java.lang.RuntimeException: Handler (com.***.behavior.BEvent$1) {421bca80} sending message to a Hand
2016-11-30 18:12
405 查看
java.lang.RuntimeException: Handler (com.***.behavior.BEvent$1) {421bca80} sending message to a Handler on a dead thread
它告诉你,你往死了的进程发了一个消息,然后没有办法执行。
我的代码错在这里:
sHandler.post(runnable);
handler虽然不为空,(静态的),但是它所在的进程已经死了(推出了程序),所以你post 就会出现上面的警告。我们看下post源码:
/** * Causes the Runnable r to be added to the message queue. * The runnable will be run on the thread to which this handler is * attached. * * @param r The Runnable that will be executed. * * @return Returns true if the Runnable was successfully placed in to the * message queue. Returns false on failure, usually because the * looper processing the message queue is exiting. */ public final boolean post(Runnable r) { return sendMessageDelayed(getPostMessage(r), 0); }
The runnable will be run on the thread to which this handler is
* attached.
所以 进程死了,就没有办法运行了。
总结:
1.代码没执行,记得看logcat的警告。
logcat的error,会直接crash.
warn 代码没执行,或者其他的问题,都会warn.
2.android程序退出了,但是进程没有杀死。
所有的静态变量,暂时还保存着。
相关文章推荐
- java.lang.RuntimeException: Handler (android.os.Handler) sending message to a Handler on a dead thre
- java.lang.RuntimeException: Handler{405c1180} sending message to a Handler on a dead thread
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.w/com.example.w.MainA
- java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.AndroidCaptureC
- java.lang.RuntimeException: Unable to instantiate application com.android.tools.fd.runtime.Boo
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.esri.arcgis.android.samples.h
- java.lang.RuntimeException: Unable to instantiate application com.android.tools.fd.runtime.Bootstrap
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ex.activity/com.ex.activity.LoginActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.clm.activity/com.clm.activity
- java.lang.RuntimeException: Unable to instantiate application com.android.tools.fd.runtime.Bootstrap
- java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.yf.huiju/com.yf.huiju.a
- java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.gditc.mmms/com.gditc.mm
- java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.badlogic.androidgames.
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.FirstView/com.example
- java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.irun/com.exampl
- java.lang.RuntimeException: Unable to stop activity {com.borqs.musicdemo/com.borqs.musicdemo.MainAct
- java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge de
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.clm.activity/com.clm.activity
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.hbsjz/com.hbsjz.BaseMapActivity}:
- android中使用fragment时出现如下错误 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fra