FileDocCategorySizeDatePackage
PreferenceInflater.javaAPI DocAndroid 5.1 API4033Thu Mar 12 22:22:10 GMT 2015android.preference

PreferenceInflater

public class PreferenceInflater extends GenericInflater
The {@link PreferenceInflater} is used to inflate preference hierarchies from XML files.

Do not construct this directly, instead use {@link Context#getSystemService(String)} with {@link Context#PREFERENCE_INFLATER_SERVICE}.

Fields Summary
private static final String
TAG
private static final String
INTENT_TAG_NAME
private static final String
EXTRA_TAG_NAME
private PreferenceManager
mPreferenceManager
Constructors Summary
public PreferenceInflater(android.content.Context context, PreferenceManager preferenceManager)

    
         
        super(context);
        init(preferenceManager);
    
PreferenceInflater(GenericInflater original, PreferenceManager preferenceManager, android.content.Context newContext)

        super(original, newContext);
        init(preferenceManager);
    
Methods Summary
public GenericInflatercloneInContext(android.content.Context newContext)

        return new PreferenceInflater(this, mPreferenceManager, newContext);
    
private voidinit(PreferenceManager preferenceManager)

        mPreferenceManager = preferenceManager;
        setDefaultPackage("android.preference.");
    
protected booleanonCreateCustomFromTag(org.xmlpull.v1.XmlPullParser parser, Preference parentPreference, android.util.AttributeSet attrs)

        final String tag = parser.getName();
        
        if (tag.equals(INTENT_TAG_NAME)) {
            Intent intent = null;
            
            try {
                intent = Intent.parseIntent(getContext().getResources(), parser, attrs);
            } catch (IOException e) {
                XmlPullParserException ex = new XmlPullParserException(
                        "Error parsing preference");
                ex.initCause(e);
                throw ex;
            }
            
            if (intent != null) {
                parentPreference.setIntent(intent);
            }
            
            return true;
        } else if (tag.equals(EXTRA_TAG_NAME)) {
            getContext().getResources().parseBundleExtra(EXTRA_TAG_NAME, attrs,
                    parentPreference.getExtras());
            try {
                XmlUtils.skipCurrentTag(parser);
            } catch (IOException e) {
                XmlPullParserException ex = new XmlPullParserException(
                        "Error parsing preference");
                ex.initCause(e);
                throw ex;
            }
            return true;
        }
        
        return false;
    
protected PreferenceGrouponMergeRoots(PreferenceGroup givenRoot, boolean attachToGivenRoot, PreferenceGroup xmlRoot)

        // If we were given a Preferences, use it as the root (ignoring the root
        // Preferences from the XML file).
        if (givenRoot == null) {
            xmlRoot.onAttachedToHierarchy(mPreferenceManager);
            return xmlRoot;
        } else {
            return givenRoot;
        }