0

I want to ask if its possibile to set for each values/entries in my List, that I can choose them just one time, I mean: I have more ListPreference that use same Values/Entries, if I choose the first values/entries in the first listPreference, I want to disable the first values/entries for other ListPreference. Thank you.

X_Wen
  • 21
  • 5

1 Answers1

0

The first issue is that you want to disable some items in ListPreferences, this is not supported there out of box. I would recommend to use this approach to make a custom ListPreference supporting disabled items.

The second issue is that you want to share info about selected items between several ListPreferences, for that you need to modify CustomListPreferenceAdapter code there to use the same set of data, including info about items selected in all ListPreferences. So you probably need to use a List where item keeps info about its selection as well (though Adapter pattern is designed to abstract from selection being made on ListView side, but in your case you want the selection info to be part of data, huh). And when any ListPreference (or a ListView too in generic case) makes a selection, you need to notify adapters of other ListPreferences to re-read selection data and disable relevant items.

I'm a bit lazy to write whole code for you )) Use it as a hint.

Community
  • 1
  • 1
Mixaz
  • 4,068
  • 1
  • 29
  • 55
  • I dont want selection info to be part of my data, just values, Ill try to do what you said. Thank you. – X_Wen Sep 24 '16 at 04:53