I am currently working on an droid app and was wondering if there is a way that a preference can be enabled or disabled based on the value of another preference.
For example, if I have checkbox_pref1 if this is enabled then option2/3/4 are enabled, if checkbox_pref1 is disabled option2/3/4 automatically become disabled or is this there an XML attribute that would accomplish this or is it something that I would need to code to achieve this effect.
Thanks for any help you can provide.
You can do this with the dependency
attribute. In your Preference
XML, you would add the following line to your checkbox_pref2
, checkbox_pref3
, and checkbox_pref2
Preferences:
android:dependency="checkbox_pref1"
Useful Links: