We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handler机制有一个特点是不会随着Activity、Service的生命周期结束而结束。也就是说,如果你Post了一个Delay的Runnable,然后在Runnable执行之前退出了Activity,Runnable到时间之后还是要执行的。如果Runnable里面包含更新View的操作,程序崩溃了。
Runnable里强引用到View,会阻止Activity或Service销毁,在Runnable执行完之后才会销毁,所以造成内存泄露。而如果引用的View是使用WeakReference才会有崩溃的情况,需要判断View是否为null
The text was updated successfully, but these errors were encountered:
e17af0b
No branches or pull requests
Runnable里强引用到View,会阻止Activity或Service销毁,在Runnable执行完之后才会销毁,所以造成内存泄露。而如果引用的View是使用WeakReference才会有崩溃的情况,需要判断View是否为null
The text was updated successfully, but these errors were encountered: