Activity
   |
   |
Fragment1 --> Fragment2 --> Fragment3 --> Fragment4
                                        |
                                        |
                                    Orientation changed
                                        |
                                        |
                       Fragment3 <-- Fragment4
                            |
                            |
                       Fragment3 --> Fragment5 


 Scenario : 1. I am having an application with single activity with fragment.
            2. In oncreate of fragment i enabled setRetainInstance(true);
            3. After launching the activity i am navigating from fragment 1 to fragment 2 by added to back stack and commit.
            4. Same for fragment 2 to fragment 3 and fragment 3 to fragment 4.
            5. From fragment 4 i changed the orientation. As mentioned due to setRetainInstance(true);. Fragment 4 onViewCreated has called.
            6. But when go back to fragment 3 by pressing back button. And make a transcation from fragment 3 to frament 5. I got an exception "*

java.lang.IllegalStateException:无法在onSaveInstanceState之后执行此操作

” .

**As far as i searched i found few solution,
1. override onSavedInstance, dont call super method. [I dont want to use this]
2. And manifest declare , android:configChanges="orientation|screenSize|keyboardHidden" [I dont want to use this] I want to handle config changes.**

请问有人解释一下在方向改变后处理背斜碎片的正确方法是什么 . [注意:当我尝试从片段3提交到新片段5时,它会崩溃 . ]

FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        transaction.addToBackStack(TAG);
        transaction.replace(containerID, baseFragment,TAG);
        transaction.commit();