ViewRoot$CalledFromWrongThreadException 和内存泄漏

来源:互联网 发布:何林夏 知乎 编辑:程序博客网 时间:2024/05/18 01:53
Activity XXX.XXX has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@46021980 that was originally added here01-15 14:48:13.153: E/WindowManager(6360): android.view.WindowLeaked: Activity  XXX.XXX has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@46021980 that was originally added here

以上内存泄漏,有一种情况是Activity释放时,基于它的Dialog等没有释放导致的。





android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views


UI的更新只能在UI线程,也就是主线程中更新,否则就会产生如上错误。


原创粉丝点击