我有一个简单的Activity和Retained Fragment,就像Alex Lockwood blog post example一样。
我的 Activity 在onCreate()
中是这样的:
FragmentManager fm = getSupportFragmentManager();
retainedFragment = (GridFragment) fm.findFragmentByTag(RETAINED_FRAGMENT_TAG);
// If the Fragment is non-null, then it is currently being
// retained across a configuration change.
if (retainedFragment == null) {
retainedFragment = new GridFragment();
fm.beginTransaction().add(retainedFragment, RETAINED_FRAGMENT_TAG).commit();
}else{
list = retainedFragment.getList();
System.out.println(list.size());//OUTPUT 12
}
我的
Fragments
'onAttach()
是: @Override
public void onAttach(Context activity) {
super.onAttach(activity);
mCallbacks = (TaskCallbacks) activity;
System.out.println("here"); //OUTPUT here
}
现在,在每次屏幕旋转时,我都会得到非常奇怪的输出:
在我的输入之间,奇怪的警告从何而来?怎么处理呢?提前致谢!
最佳答案
该消息无关紧要,多余的日志已在支持库v24.0.0中删除
这是官方开发人员answer: