ViewRoot$CalledFromWrongThreadException 和内存泄漏

Activity XXX.XXX has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@46021980 that was originally added here
01-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线程,也就是主线程中更新,否则就会产生如上错误。


你可能感兴趣的:(ViewRoot$CalledFromWrongThreadException 和内存泄漏)