Best code examples for Android Preference class (android.preference.Preference)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Preference class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android Preference examples from Open Source projects
This code example shows how to use the following methods: setOnPreferenceClickListener, setSummary, Preference.setIcon, Preference.setTitle
64:	mSubtypeEnablerPreference = new Preference(context); 
-
66:	.setOnPreferenceClickListener(new OnPreferenceClickListener() { 
-
183:	mSubtypeEnablerPreference.setTitle(mSubtypeEnablerTitleRes); 
-
185:	mSubtypeEnablerPreference.setTitle(mSubtypeEnablerTitle); 
-
189:	mSubtypeEnablerPreference.setSummary(summary); 
-
192:	mSubtypeEnablerPreference.setIcon(mSubtypeEnablerIconRes); 
-
194:	mSubtypeEnablerPreference.setIcon(mSubtypeEnablerIcon); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setOnPreferenceChangeListener, setChecked
52:	pref.setChecked(mgr.isAdminActive(cn)); 
53:	pref.setOnPreferenceChangeListener(this); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getContext, getKey, setOnPreferenceChangeListener
213:	.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener); 
-
220:	preference.getContext()).getString(preference.getKey(), 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setEnabled, setChecked
78:	mCheckbox.setChecked(false); 
79:	mCheckbox.setEnabled(true); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setOnPreferenceClickListener, setSummary, Preference.setIcon, Preference.setTitle
63:	mSubtypeEnablerPreference = new Preference(context); 
-
65:	.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { 
-
182:	mSubtypeEnablerPreference.setTitle(mSubtypeEnablerTitleRes); 
-
184:	mSubtypeEnablerPreference.setTitle(mSubtypeEnablerTitle); 
-
188:	mSubtypeEnablerPreference.setSummary(summary); 
-
191:	mSubtypeEnablerPreference.setIcon(mSubtypeEnablerIconRes); 
-
193:	mSubtypeEnablerPreference.setIcon(mSubtypeEnablerIcon); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setSummary, setValue, getKey
132:	String value = Settings.System.getString(getContentResolver(), pref.getKey()); 
-
137:	CharSequence entry = findEntryForValue(pref, value); 
-
139:	pref.setValue(value); 
140:	pref.setSummary(entry); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getKey, setOnPreferenceChangeListener
139:	preference.setOnPreferenceChangeListener(sSetSummaryListener); 
-
143:	.onPreferenceChange(preference, prefs.getString(preference.getKey(), "")); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getContext, setSummary
82:	preference.setSummary( 
-
96:	preference.getContext(), Uri.parse(stringValue)); 
-
104:	String name = ringtone.getTitle(preference.getContext()); 
105:	preference.setSummary(name); 
-
112:	preference.setSummary(stringValue); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getContext, getKey, setOnPreferenceChangeListener
117:	preference.setOnPreferenceChangeListener(listener); 
-
123:	.getDefaultSharedPreferences(preference.getContext()) 
124:	.getString(preference.getKey(), "")); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getKey, setDependency
244:	mHapticFeedbackUpPref.setDependency(mHapticFeedbackPref.getKey()); 
245:	mHapticFeedbackAllPref.setDependency(mHapticFeedbackUpPref.getKey()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setDependency, setKey, setChecked
173:	pref.setKey(baseName + "_" + key); 
174:	pref.setDependency(dependency == null? null: dependency + "_" + key); 
-
176:	pref.setChecked(sharedPrefs.getBoolean(baseName + "_" + key, defValue)); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getContext, getKey, setOnPreferenceChangeListener
121:	preference.setOnPreferenceChangeListener(listener); 
-
127:	.getDefaultSharedPreferences(preference.getContext()) 
128:	.getBoolean(preference.getKey(), true)); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getKey
52:	String key = preference.getKey(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getEntry, setSummary, setOnPreferenceChangeListener
133:	listPref.setSummary(listPref.getEntry()); 
134:	listPref.setOnPreferenceChangeListener(this); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getKey
52:	String key = preference.getKey(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getContext, setSummary
63:	preference.setSummary( 
-
78:	preference.getContext(), Uri.parse(stringValue)); 
-
86:	String name = ringtone.getTitle(preference.getContext()); 
87:	preference.setSummary(name); 
-
94:	preference.setSummary(stringValue); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setDefaultValue, setKey, setOnPreferenceChangeListener, setSummary, setTitle
155:	CheckBoxPreference preference = new CheckBoxPreference(this); 
156:	preference.setTitle(name); 
157:	preference.setSummary(desc); 
158:	preference.setKey(key); 
159:	preference.setDefaultValue(def); 
-
161:	preference.setOnPreferenceChangeListener(lis); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getEntry, setSummary, setOnPreferenceChangeListener
69:	listPref.setSummary(listPref.getEntry()); 
70:	listPref.setOnPreferenceChangeListener(this); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setText, setSummary
56:	mXmppResource.setText(text); 
-
58:	mXmppResource.setSummary(text); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setOnPreferenceClickListener, setSummary, setTitle, Preference.setIcon
58:	mSubtypeEnablerPreference = new Preference(context); 
-
60:	.setOnPreferenceClickListener(new OnPreferenceClickListener() { 
-
177:	mSubtypeEnablerPreference.setTitle(mSubtypeEnablerTitleRes); 
-
183:	mSubtypeEnablerPreference.setSummary(summary); 
-
186:	mSubtypeEnablerPreference.setIcon(mSubtypeEnablerIconRes); 
-
188:	mSubtypeEnablerPreference.setIcon(mSubtypeEnablerIcon); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setSummary
90:	pref.setSummary(mPicker.getFriendlyNameForUri(value)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setEnabled, setOnPreferenceChangeListener, isChecked
66:	volUpShutter.setOnPreferenceChangeListener(this); 
-
73:	volUpShutter.setOnPreferenceChangeListener(null); 
-
102:	if (volUpShutter.isChecked() || volDownShutter.isChecked()) { 
-
104:	} else if (!volUpShutter.isChecked() && !volDownShutter.isChecked()) { 
-
108:	volUpShutter.setEnabled(false); 
-
112:	volUpShutter.setEnabled(true); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setDefaultValue, setKey, setSummary, setTitle
157:	CheckBoxPreference proximityEnabled = new CheckBoxPreference(this); 
158:	proximityEnabled.setKey(PREFS_PROXIMITY_ENABLED); 
159:	proximityEnabled.setTitle("Address Proximity Context"); 
160:	proximityEnabled.setSummary("Enable/Disable ContextProvider Address Proximity Tracking"); 
161:	proximityEnabled.setDefaultValue(new Boolean(PREFS_PROXIMITY_ENABLED_DEFAULT)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setValueIndex, setOnPreferenceChangeListener
109:	mTextZoom.setValueIndex(mPreferences.getTextZoom()); 
110:	mTextZoom.setOnPreferenceChangeListener(this); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setSummary
185:	preference.setSummary( index >= 0 ? listPreference.getEntries()[index] : null ); 
-
193:	preference.setSummary( stringValue ); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getKey
55:	if (preference.getKey().equals(BUTTON_VP_KEY)) { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getContext, setSummary
77:	preference.setSummary( 
-
92:	preference.getContext(), Uri.parse(stringValue)); 
-
100:	String name = ringtone.getTitle(preference.getContext()); 
101:	preference.setSummary(name); 
-
111:	preference.setSummary(stringValue); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getContext, getKey, setOnPreferenceChangeListener
37:	preference.setOnPreferenceChangeListener(update_summary_pref_listener); 
-
41:	preference.getContext()).getString(preference.getKey(), 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setIcon, setIntent, setPersistent, setTitle
152:	Preference aPref = new Preference(_context); 
153:	aPref.setPersistent(false); 
154:	aPref.setTitle(iFile.getName()); 
-
156:	aPref.setIcon(iIconResId); 
-
161:	aPref.setIntent(aIntent); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getEntry, setSummary, setOnPreferenceChangeListener
114:	snooze.setSummary(snooze.getEntry()); 
115:	snooze.setOnPreferenceChangeListener(this); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setSummary
28:	preference.setSummary(x.getEntries()[index]); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setOnPreferenceClickListener, setSummary, setTitle, Preference.setIcon
58:	mSubtypeEnablerPreference = new Preference(context); 
-
60:	.setOnPreferenceClickListener(new OnPreferenceClickListener() { 
-
177:	mSubtypeEnablerPreference.setTitle(mSubtypeEnablerTitleRes); 
-
183:	mSubtypeEnablerPreference.setSummary(summary); 
-
186:	mSubtypeEnablerPreference.setIcon(mSubtypeEnablerIconRes); 
-
188:	mSubtypeEnablerPreference.setIcon(mSubtypeEnablerIcon); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getKey
327:	if (KEY_DEFAULT_RATE.equals(preference.getKey())) { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getKey
195:	if (preference.getKey().equals("ui_general_iconpack")) { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getKey
257:	final String key = preference.getKey(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getKey
342:	removeCustomApplicationPref(pref.getKey()); 
Full Snippet Info
6
CodeRank
Related Android Preference Questions & Answers:
See Code Examples for Android Preference Methods: