/** * Recursive method used to descend down the xml hierarchy and instantiate items, instantiate * their children, and then call onFinishInflate(). */ private void rInflate(XmlPullParser parser, Preference parent, final AttributeSet attrs) throws XmlPullParserException, IOException { final int depth = parser.getDepth(); int type; while (((type = parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) { if (type != XmlPullParser.START_TAG) { continue; } final String name = parser.getName(); if (INTENT_TAG_NAME.equals(name)) { final Intent intent; try { intent = Intent.parseIntent(getContext().getResources(), parser, attrs); } catch (IOException e) { XmlPullParserException ex = new XmlPullParserException("Error parsing preference"); ex.initCause(e); throw ex; } parent.setIntent(intent); } else if (EXTRA_TAG_NAME.equals(name)) { getContext().getResources().parseBundleExtra(EXTRA_TAG_NAME, attrs, parent.getExtras()); try { skipCurrentTag(parser); } catch (IOException e) { XmlPullParserException ex = new XmlPullParserException("Error parsing preference"); ex.initCause(e); throw ex; } } else { final Preference item = createItemFromTag(name, attrs); ((PreferenceGroup) parent).addItemFromInflater(item); rInflate(parser, item, attrs); } } }
@Override public boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref) { startPreferencePanel( pref.getFragment(), pref.getExtras(), pref.getTitleRes(), pref.getTitle(), null, 0); return true; }