List of usage examples for android.preference PreferenceFragment getString
public final String getString(@StringRes int resId)
From source file:Main.java
/** * Removes a {@link Preference} from the {@link PreferenceCategory} with the given key. *///w ww .j ava 2 s . c o m public static void removePreference(PreferenceFragment prefFrag, int parentKey, int prefKey) { String parentName = prefFrag.getString(parentKey); String prefName = prefFrag.getString(prefKey); PreferenceGroup parent = (PreferenceGroup) prefFrag.findPreference(parentName); Preference child = prefFrag.findPreference(prefName); if (parent != null && child != null) { parent.removePreference(child); } }
From source file:Main.java
/** * Gets a preference and sets the {@link android.preference.Preference.OnPreferenceChangeListener}. *///from w w w. j a v a 2s.com public static Preference getPrefAndSetClickListener(PreferenceFragment prefFrag, int id, Preference.OnPreferenceClickListener listener) { Preference pref = prefFrag.findPreference(prefFrag.getString(id)); if (pref != null) pref.setOnPreferenceClickListener(listener); return pref; }
From source file:Main.java
/** * Gets a preference and sets the {@link android.preference.Preference.OnPreferenceChangeListener}. *//*from www. jav a 2 s . c om*/ public static Preference getPrefAndSetChangeListener(PreferenceFragment prefFrag, int id, Preference.OnPreferenceChangeListener listener) { Preference pref = prefFrag.findPreference(prefFrag.getString(id)); if (pref != null) pref.setOnPreferenceChangeListener(listener); return pref; }