I have a ListPreference which look something like this:
<ListPreference
android:title="Choose item"
android:summary="..."
android:key="itemList"
android:defaultValue="item1"
android:entries="@array/items"
android:entryValues="@array/itemValues" />
Then, I have another preference which should only be enabled if “item3” is selected in the ListPreference.
Can I somehow accomplish this with android:dependency? Something like android:dependency="itemList:item3"
Thanks!
The only way you can do something like this is programmaticly.
You’d have to set up an change listener on the ListPreference and then enable/disable the other one.
If I were you I wouldn’t even show the second preference if the first isn’t set properly. To do that you have to declare the preference manually (not in the XML) and add/remove it instead of enabling/disabling.
Now isn’t this the bestest answer you’ve ever seen?!
Emmanuel