I have a ListView with several choices, where some of them are checked from the very beginning, using
setItemChecked(position, true);
I combine this with the filter option
setTextFilterEnabled(true)
therefore, it is easy to find a specific entry in the list.
The problem is that when I filter the list, the input positions switch as a list. Take, for example, three entries: “A”, “B”, and “C”, where “C” is checked in advance (that is, the entry at position 3 in the list). When I type “C” on the keyboard, only the “C” entry is displayed (optional). Now “C” is no longer checked, as the record has moved from position 3 to unchecked position 1 in the list.
This behavior leads to some not very pleasant effects in the application. Is there a way to "move the selection using filtering", i.e. Bind the checked state to the record, and not to its initial position in the list? Or do I need to find a new approach?
Thanks,
Linus
android checkbox listview filtering
aspartame
source share