Example usage for android.app FragmentManager putFragment

List of usage examples for android.app FragmentManager putFragment

Introduction

In this page you can find the example usage for android.app FragmentManager putFragment.

Prototype

public abstract void putFragment(Bundle bundle, String key, Fragment fragment);

Source Link

Document

Put a reference to a fragment in a Bundle.

Usage

From source file:com.ape.filemanager.FileExplorerTabActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    FragmentManager fm = getFragmentManager();
    fm.putFragment(outState, Util.FRAGMENT_CATEGORY, mFragmentAdapter.getItem(0));
    fm.putFragment(outState, Util.FRAGMENT_SDCARD, mFragmentAdapter.getItem(1));
    fm.putFragment(outState, Util.FRAGMENT_REMOTE, mFragmentAdapter.getItem(2));
}

From source file:us.cboyd.android.dicom.DcmBrowser.java

/** Called when orientation changes. */
@Override/*from ww w  .j av a2 s  . c  o m*/
public void onSaveInstanceState(Bundle outState) {
    FragmentManager fragManager = getFragmentManager();
    // If the fragment hasn't already been added to the FragmentManager, add it.
    // Otherwise, it can't be put in the Bundle.
    if (!mInfoFragment.isAdded()) {
        fragManager.beginTransaction().add(mInfoFragment, null).commit();
    }

    super.onSaveInstanceState(outState);
    outState.putString(DcmVar.CURRDIR, mListFragment.getDir().getAbsolutePath());
    fragManager.putFragment(outState, DcmVar.FRAGLIST, mListFragment);
    fragManager.putFragment(outState, DcmVar.FRAGINFO, mInfoFragment);
}