Code example for PreferenceCategory

Methods: removePreference

0
 
	private void removeImportExportIfNoSdCard() { 
		PreferenceCategory advanced = (PreferenceCategory) findPreference(SettingsActivity.KEY_ADVANCED);
		Preference importExport = findPreference(SettingsActivity.KEY_IMPORT_EXPORT);
		if (advanced != null && importExport != null && !FileHandler.isSdCardMounted()) {
			advanced.removePreference(importExport);
		} 
	} 
 
	/** 
	 * Remove option if voices are already installed or if available space on external storage < 100MB. 
	 */ 
	private void removeInstallTtsIfNoFreeSpaceOnExternalStoreOrAlreadyInstalled() { 
		PreferenceCategory advanced = (PreferenceCategory) findPreference(SettingsActivity.KEY_ADVANCED);
		Preference installTts = findPreference(SettingsActivity.KEY_INSTALL_TTS);
 
		if (advanced != null && installTts != null
				&& (FileHandler.getFreeSpaceInExternalStorage() < 100 
						|| FileHandler.areVoicesInstalled())) { 
			advanced.removePreference(installTts);
		}