Language

FragmentManager.SaveFragmentInstanceState(Fragment) Method

Definition

Save the current instance state of the given Fragment.

[Android.Runtime.Register("saveFragmentInstanceState", "(Landroid/app/Fragment;)Landroid/app/Fragment$SavedState;", "GetSaveFragmentInstanceState_Landroid_app_Fragment_Handler")]
public abstract Android.App.Fragment.SavedState? SaveFragmentInstanceState(Android.App.Fragment? f);
[<Android.Runtime.Register("saveFragmentInstanceState", "(Landroid/app/Fragment;)Landroid/app/Fragment$SavedState;", "GetSaveFragmentInstanceState_Landroid_app_Fragment_Handler")>]
abstract member SaveFragmentInstanceState : Android.App.Fragment -> Android.App.Fragment.SavedState

Parameters

f
Fragment

Fragment: The Fragment whose state is to be saved.

Returns

The generated state. This will be null if there was no interesting state created by the fragment.

Attributes

Remarks

Save the current instance state of the given Fragment. This can be used later when creating a new instance of the Fragment and adding it to the fragment manager, to have it create itself to match the current state returned here. Note that there are limits on how this can be used: The Fragment must currently be attached to the FragmentManager. A new Fragment created using this saved state must be the same class type as the Fragment it was created from. The saved state can not contain dependencies on other fragments -- that is it can't use putFragment(Bundle,String,Fragment) to store a fragment reference because that reference may not be valid when this saved state is later used. Likewise the Fragment's target and result code are not included in this state.

Android reference for android.app.FragmentManager.saveFragmentInstanceState.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to