Code example for Preference

Methods: getContextgetKeysetOnPreferenceChangeListener

0
	 * @see #sBindPreferenceSummaryToValueListener 
	 */ 
	private static void bindPreferenceSummaryToValue( Preference preference )
	{ 
		// Set the listener to watch for value changes. 
		preference.setOnPreferenceChangeListener( SettingsActivity.sBindPreferenceSummaryToValueListener );
 
		// Trigger the listener immediately with the preference's current value. 
		String newValue = PreferenceManager.getDefaultSharedPreferences( preference.getContext() ).getString( preference.getKey(), "" );
		SettingsActivity.sBindPreferenceSummaryToValueListener.onPreferenceChange( preference, newValue );
	} 
 
	/** 
	 * Determines whether the simplified settings UI should be shown. This is true if this is forced via 
	 * {@link #ALWAYS_SIMPLE_PREFS}, or the device doesn't have newer APIs like {@link PreferenceFragment}, or the 
	 * device doesn't have an extra-large screen. In these cases, a single-pane "simplified" settings UI should be 
	 * shown. 
	 */ 
	private static boolean isSimplePreferences( Context context )
	{ 
		return SettingsActivity.ALWAYS_SIMPLE_PREFS || Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB