I am trying to write a ListView that is filled with CheckedTextViews and uses a filter to allow the user to quickly search the ListView (which is backed by an array with a custom ArrayAdapter). I have set the multipleChoice flag in the XML that declares the listview and I can check/uncheck multiple entries when not using the filter. When using the filter to search for an entry, I am able to select an entry. However, when I clear the filter (by hitting backspace) the entry at the same position remains checked enventhough it is no longer the actual entry that I want checked.
I have tried manually setting the checked state on the CheckedTextView in the adapter's getView() method but that does not seem to be working. Just for grins, I tried setting isChecked to false in every CheckedTextView in the ListView, but the CheckedTextView that was checked while using the filter remains checked.
Has anyone had any luck implementing something like this or have any recommendations?
Thanks Adam
I was looking at ListView.clearChoices() , but I was hoping there was another way. What I eneded up doing was calling ListView.clearChoices() whenever the filter is changed, manually keeping track of what has been selected, and calling ListView.setItemChecked() from ArrayAdapter.getView(). This prevents me from having to iterate over the whole list all the time.