调用 LoaderCallbacks.onLoadFinished() 时的规则是什么?
对于提供 LoaderManager
的 Activity
的生命周期,是否有关于何时调用 LoaderCallbacks.onLoadFinished()
的规则?
我从 Android 文档中知道,onLoadFinished()
可能会在 Activity
保存其状态后调用(即可能早在 Activity
已暂停),但我想知道框架何时可能会或可能不会调用它。
提前致谢。
Are there rules about when LoaderCallbacks.onLoadFinished()
will be called in relation to the lifecycle of the Activity
that provided the LoaderManager
?
I know from the Android documentation that onLoadFinished()
may be called after the Activity
has saved its state (i.e. possibly as early as when the Activity
is paused), but I'd like to know when else it may or may not be called by the framework.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚查看了 FragmentActivity 和 LoaderManager 源代码,从我所看到的
LoaderCallbacks.onLoadFinished()
可以在onStart()
和onStop 之间调用仅 ()
。更准确地说,
LoaderCallbacks.onLoadFinished()
由变量mStarted
决定,该变量在onStart()
和onStop() 中设置
。I've just looked at the FragmentActivity and LoaderManager source code and from what I've seen
LoaderCallbacks.onLoadFinished()
can be call betweenonStart()
andonStop()
only.More precisely, the
LoaderCallbacks.onLoadFinished()
is conditioned by the variablemStarted
which is set inonStart()
andonStop()
.