Code example for EditTextPreference

Methods: getSummary

0
	 
	public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
	    Preference pref = findPreference(key);
	    if (pref instanceof EditTextPreference) {
	    	EditTextPreference textPref = (EditTextPreference) pref;
	        pref.setSummary(textPref.getSummary());
	        Log.d("KALSMS", "textPref.getSummary(): " + textPref.getSummary());
	    } 
	    if(pref instanceof CheckBoxPreference) {
	    	CheckBoxPreference checkbox = (CheckBoxPreference) pref;
	    	AlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE); 
	    	Intent pintent = new Intent(this, SMSSender.class);
	    	PendingIntent pIntent = PendingIntent.getBroadcast(this,0,pintent, 0);
	    	if(checkbox.isChecked()) {
	    		long interval = 60*Integer.valueOf(PreferenceManager.getDefaultSharedPreferences(this).getString("pref_poll_interval", "5000"));//5mins;//5mins
	    		long firstPoll = SystemClock.elapsedRealtime() + 60*Integer.valueOf(PreferenceManager.getDefaultSharedPreferences(this).getString("pref_poll_interval", "5000"));
	    		alarm.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, firstPoll, interval, pIntent);
	    		Log.d("KALSMS", "alarm manager turned on "+interval);
	    	}else { 
	    		alarm.cancel(pIntent);
	    		Log.d("SMS_GATEWAY", "alarm manager turned off");