java.lang.IllegalStateException: Failure saving state: active has cleared index in fragment

前端 未结 3 1214
别跟我提以往
别跟我提以往 2021-02-13 04:51

First, my app has structure like this:

 SpashActivity -> MainActivity -> switching between many fragments

My app use SlideMenu to switch

3条回答
  •  青春惊慌失措
    2021-02-13 05:37

    The state of your fragments is automatically saved and restored, there is no need to do anything in your onSaveInstanceState method. Don't hold any references to your Fragments in your Activity (in your case currentFragment, mContent), if you need a certain Fragment, get it from FragmentManager by e.g. findFragmentByTag.

提交回复
热议问题