装载机不会保留,总是在方向改变创建 [英] Loader not retained and always created on orientation change

查看:214
本文介绍了装载机不会保留,总是在方向改变创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个活动A 包含片段B 包含 C片段

目前,片段B LoaderManager 管理​​一个 CursorLoader 。该数据是给 C片段

Currently, Fragment B's LoaderManager manages one CursorLoader. The data is given to Fragment C.

在改变方向时,加载器丢失: initLoader 总是导致 onCreateLoader 由系统调用的操作。但是,<一个href=\"http://developer.android.com/reference/android/app/LoaderManager.html#initLoader(int,%20android.os.Bundle,%20android.app.LoaderManager.LoaderCallbacks<D>)\"相对=nofollow>文档说:

On orientation change, the loader is lost: initLoader always leads to onCreateLoader being invoked by the system. However, the documentation says:

如果加载不存在,则创建一个和(如果活动/片段目前启动)开始的装载器。否则最后创建的加载器重新使用。

If the loader doesn't already exist, one is created and (if the activity/fragment is currently started) starts the loader. Otherwise the last created loader is re-used.

我如何得到这个行为?

推荐答案

这是一个开放的bug,谷歌已经意识到并修复它。

It's an open bug, Google is aware and hopefully plan on fixing it

HTTPS://$c$c.google。 COM / p /安卓/问题/细节?ID = 183783

这篇关于装载机不会保留,总是在方向改变创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆