savedInstanceState when restoring fragment from back stack

后端 未结 4 436
礼貌的吻别
礼貌的吻别 2021-01-31 15:53

Can I use savedInstanceState() to save the state when removing a fragment, then restore the state when I pop the fragment off the back stack? When I restore the fr

4条回答
  •  长发绾君心
    2021-01-31 16:11

    onSaveInstanceState is (unfortunately) not called in normal back-stack re-creation of a fragment. Check out http://developer.android.com/guide/components/fragments.html#Creating and the answer on How can I maintain fragment state when added to the back stack?

提交回复
热议问题