Android View.postDelayed 是否泄漏引用?
Does Android View.postDelayed leak reference?
我想知道传递给 View.postDelayed
的 runnable 是否会在视图与父视图分离时自动删除。
我查看了 View
class 的源代码,它被发布到一些 Handler
外面。但该处理程序的生命周期尚不清楚。
有谁知道答案吗?
I wonder if runnable passed to View.postDelayed will be automatically
removed when the view is detached from the parent.
会在运行方法结束后执行。如果你有一个无限循环,它永远不会被删除,因此,你将泄漏视图,以及使用该视图的 Activity。
我想知道传递给 View.postDelayed
的 runnable 是否会在视图与父视图分离时自动删除。
我查看了 View
class 的源代码,它被发布到一些 Handler
外面。但该处理程序的生命周期尚不清楚。
有谁知道答案吗?
I wonder if runnable passed to View.postDelayed will be automatically removed when the view is detached from the parent.
会在运行方法结束后执行。如果你有一个无限循环,它永远不会被删除,因此,你将泄漏视图,以及使用该视图的 Activity。