Example usage for android.app Fragment getFragmentManager

List of usage examples for android.app Fragment getFragmentManager

Introduction

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

Prototype

final public FragmentManager getFragmentManager() 

Source Link

Document

Return the FragmentManager for interacting with fragments associated with this fragment's activity.

Usage

From source file:Main.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public static FragmentManager getChildFragmentManagerIfAvailable(Fragment fragment) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        return fragment.getChildFragmentManager();
    } else {//from   ww w.j ava2s.  c o  m
        return fragment.getFragmentManager();
    }
}

From source file:com.afwsamples.testdpc.policy.keyguard.LockScreenPolicyFragment.java

private void showSetTrustAgentFragment() {
    int type = isParentProfileInstance() ? Type.PARENT : Type.SELF;
    SetTrustAgentConfigFragment fragment = SetTrustAgentConfigFragment.newInstance(type);
    Fragment containerFragment = getParentFragment();
    if (containerFragment == null) {
        containerFragment = this;
    }// w ww  .jav  a  2  s  . c om
    containerFragment.getFragmentManager().beginTransaction()
            .addToBackStack(SetTrustAgentConfigFragment.class.getName()).hide(containerFragment)
            .add(R.id.container, fragment).commit();
}