Skip to content Skip to sidebar Skip to footer

Are Fragments Saved By Default With Savedinstancestate?

I read on What's onCreate(Bundle savedInstanceState) that onsaveinstancestate gives you a bundle of the previous state of the application(if the orientation of the screen changed.

Solution 1:

To keep a fragment when an Activity gets destroyed, so it automatically reataches, you should call

Fragment.setRetainInstance(true)

in the Fragment's constructor. Nothing is saved by default in onSaveInstanceState()

Post a Comment for "Are Fragments Saved By Default With Savedinstancestate?"