Code example for Preference

Methods: getContextgetKeysetOnPreferenceChangeListener

0
		} 
	}; 
 
	private static void bindPreferenceSummaryToValue(Preference preference) {
		// Set the listener to watch for value changes. 
		preference.setOnPreferenceChangeListener(update_summary_pref_listener);
		update_summary_pref_listener.onPreferenceChange(
				preference,
				PreferenceManager.getDefaultSharedPreferences(preference.getContext()).getString(preference.getKey(),
						"")); 
	} 
 
	@SuppressWarnings("deprecation") 
	@Override 
	protected void onPostCreate(Bundle savedInstanceState) {
		super.onPostCreate(savedInstanceState);
		addPreferencesFromResource(R.xml.pref);
		bindPreferenceSummaryToValue(findPreference("compilation_timeout"));
		bindPreferenceSummaryToValue(findPreference("path_to_packages"));
	}