Code example for EditTextPreference

Methods: setEnabledsetSummary, getText

0
			String value = helpers.fixDoubleDisplayFromString(day_fee_box.getText().trim());
			day_fee_box.setSummary(value);
		} 
 
		if(key.equalsIgnoreCase("electrical_night_fee") || key.length() == 0) {
			String value = helpers.fixDoubleDisplayFromString(night_fee_box.getText().trim());
			night_fee_box.setSummary(value);
		} 
 
		if(key.equalsIgnoreCase("cold_water_fee") || key.length() == 0) {
			EditTextPreference cold_water_box = (EditTextPreference) this.findPreference("cold_water_fee");
			String value = helpers.fixDoubleDisplayFromString(cold_water_box.getText().trim());
			cold_water_box.setSummary(value);
		} 
 
		if(key.equalsIgnoreCase("hot_water_fee") || key.length() == 0) {
			EditTextPreference hot_water_box = (EditTextPreference) this.findPreference("hot_water_fee");
			String value = helpers.fixDoubleDisplayFromString(hot_water_box.getText().trim());
			hot_water_box.setSummary(value);
		} 
	} 
	 
	@Override 
	protected void onPause() { 
		// TODO Auto-generated method stub 
		super.onPause(); 
		prefs.unregisterOnSharedPreferenceChangeListener(this);
	} 
 
	@Override 
	protected void onResume() { 
		// TODO Auto-generated method stub 
		super.onResume(); 
		prefs.registerOnSharedPreferenceChangeListener(this);
	} 
 
	@Override 
	protected void onSaveInstanceState(Bundle outState) {
		// TODO Auto-generated method stub 
		super.onSaveInstanceState(outState);
	} 
 
 
	@Override 
	public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
			String key) {
		// TODO Auto-generated method stub 
		if(!resultSet) {
			setResult(Activity.RESULT_OK);
			resultSet = true;
		} 
		setSummaries(key);
		 
		if(key.equalsIgnoreCase("electricity_day_night")) {
			night_fee_box.setEnabled(prefs.getBoolean(key, false));
		} 
	} 
}