Code example for CheckBoxPreference

Methods: setSummary

0
				mNumberOfDepartures.setSummary("Show a maxiumum of " + sharedPreferences.getString(KEY_NUMBER_OF_DEPARTURES, "3") + " departures per platform.");
			} 
		} 
		else if(key.equals(KEY_SEND_STATS)) {
			// Send Stats 
			mSendStats.setSummary(sharedPreferences.getBoolean(key, KEY_SEND_STATS_DEFAULT_VALUE) ? 
					"Send anonymous usage statistics." : "Don't send anonymous usage statistics."); 
		}	 
		 
    } 
     
    private String getFriendlyDefaultActivityName(SharedPreferences sharedPreferences){
    	// Because the default activity setting is saved as an activity name we need to get the friendly name to show the user 
    	// in the summary of the setting 
		String[] defaultActivityEntries = getResources().getStringArray(R.array.defaultActivityEntries);
		String[] defaultActivityEntryValues = getResources().getStringArray(R.array.defaultActivityEntryValues);
		String currentDefaultActivityValue = sharedPreferences.getString(KEY_DEFAULT_LAUNCH_ACTIVITY, "Home");
    	 
		return defaultActivityEntries[findStringItemIndex(defaultActivityEntryValues, currentDefaultActivityValue)];
    }