Example usage for android.view LayoutInflater setPrivateFactory

List of usage examples for android.view LayoutInflater setPrivateFactory

Introduction

In this page you can find the example usage for android.view LayoutInflater setPrivateFactory.

Prototype

@UnsupportedAppUsage
public void setPrivateFactory(Factory2 factory) 

Source Link

Usage

From source file:android.app.FragmentState.java

/**
 * @hide Hack so that DialogFragment can make its Dialog before creating
 * its views, and the view construction can use the dialog's context for
 * inflation.  Maybe this should become a public API. Note sure.
 *///from  w w w.j  a  v a  2  s  .  c  om
public LayoutInflater getLayoutInflater(Bundle savedInstanceState) {
    // Newer platform versions use the child fragment manager's LayoutInflaterFactory.
    if (mActivity.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.LOLLIPOP) {
        LayoutInflater result = mActivity.getLayoutInflater().cloneInContext(mActivity);
        getChildFragmentManager(); // Init if needed; use raw implementation below.
        result.setPrivateFactory(mChildFragmentManager.getLayoutInflaterFactory());
        return result;
    } else {
        return mActivity.getLayoutInflater();
    }
}