Code example for Preference

Methods: setEnabled

0
		mCheckUpdatesAlarms.setOnPreferenceChangeListener(new OnPreferenceChangeListener()
		{ 
			@Override 
			public boolean onPreferenceChange(Preference _preference, Object _object) 
			{ 
				updatesFrequency.setEnabled(!((CheckBoxPreference) _preference).isChecked());
				return true; 
			} 
		}); 
		 
		updatesFrequency.setEnabled(mCheckUpdatesAlarms.isChecked());
		 
		// Needed to avoid the "flicker" effect 
		getListView().setCacheColorHint(0);
	} 
 
	@Override 
	public void onStop()  
	{ 
		// When the activity is stopped, check what services are enabled or disabled and then set or cancel the 
Connect your IDE to all the code out there  Get Codota for Java