Example usage for android.app Fragment performSaveInstanceState

List of usage examples for android.app Fragment performSaveInstanceState

Introduction

In this page you can find the example usage for android.app Fragment performSaveInstanceState.

Prototype

void performSaveInstanceState(Bundle outState) 

Source Link

Usage

From source file:android.app.FragmentManager.java

Bundle saveFragmentBasicState(Fragment f) {
    Bundle result = null;//  w w  w .  ja  v a 2 s  . c o  m

    if (mStateBundle == null) {
        mStateBundle = new Bundle();
    }
    f.performSaveInstanceState(mStateBundle);
    if (!mStateBundle.isEmpty()) {
        result = mStateBundle;
        mStateBundle = null;
    }

    if (f.mView != null) {
        saveFragmentViewState(f);
    }
    if (f.mSavedViewState != null) {
        if (result == null) {
            result = new Bundle();
        }
        result.putSparseParcelableArray(FragmentManagerImpl.VIEW_STATE_TAG, f.mSavedViewState);
    }
    if (!f.mUserVisibleHint) {
        if (result == null) {
            result = new Bundle();
        }
        // Only add this if it's not the default value
        result.putBoolean(FragmentManagerImpl.USER_VISIBLE_HINT_TAG, f.mUserVisibleHint);
    }

    return result;
}