为什么我不能为嵌套片段设置setRetainInstance(true)?

时间:2016-05-15 11:38:35

标签: android performance android-fragments

据我了解,这意味着我必须使用Bundle instance来存储片段的数据。但是这个限制的目的是什么?

public void setRetainInstance(boolean retain) {
    if (retain && mParentFragment != null) {
        throw new IllegalStateException(
                "Can't retain fragements that are nested in other fragments");
    }
    mRetainInstance = retain;
}

0 个答案:

没有答案