@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Load the preferences from an XML resource addPreferencesFromResource(R.xml.preferences); // Get the local catalog list preference and check if we need to present it // to the user, which is only the case, if there is more than one local // catalog pre-configured ListPreference localCatalogPreference = (ListPreference) findPreference(PrefUtils.PREF_LOCAL_CATALOG); if (Constants.LOCAL_CATALOGS.length > 1) { // Set entries and values for the local catalog list CharSequence[] localCatalogEntries = new CharSequence[Constants.LOCAL_CATALOGS.length]; CharSequence[] localCatalogValues = new CharSequence[Constants.LOCAL_CATALOGS.length]; int index = 0; for (String[] localCatalog : Constants.LOCAL_CATALOGS) { localCatalogEntries[index] = localCatalog[1]; localCatalogValues[index] = Integer.toString(index); index++; } localCatalogPreference.setEntries(localCatalogEntries); localCatalogPreference.setEntryValues(localCatalogValues); } else { // Remove the local catalog list preference getPreferenceScreen().removePreference(localCatalogPreference); } // Check if we need to present the dbs privacy checkbox preference // to the user, which is only the case, if there is an url pre-configured if (Constants.DBS_COUNTING_URL.isEmpty()) { getPreferenceScreen().removePreference(findPreference(PrefUtils.PREF_DATA_PRIVACY)); } }