Code example for ListPreference

Methods: getEntry, getValue

0
		if (key.equals(KEY_FREQUENCY_PREF)) {
			Preference pref = findPreference(key);
 
			if (pref instanceof ListPreference) {
				ListPreference listPref = (ListPreference) pref;
				pref.setSummary(listPref.getEntry());
 
				// Stop update service 
				Log.i(TAG, "stopping service");
				String pname = this.getPackageName();
 
				// manufacture an appropriate context 
				Context context = null;
				try { 
					context = createPackageContext(pname,
							CONTEXT_IGNORE_SECURITY);
				} catch (NameNotFoundException e) {
					e.printStackTrace();
				} 
				// and generate a pendingintent 
				PendingIntent pi = PendingIntent.getService(context, 0,
						new Intent(context, AEDUpdateService.class), 0);
 
				// Now use alarmmanager to terminate the alarm 
				AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
				am.cancel(pi);
 
				int frequency = Integer.parseInt(listPref.getValue());
				Log.i(TAG, "frequency=" + frequency + " minutes");
 
				if (frequency > 0) {
					// Start update service 
					Log.i(TAG,