Wrong item checked when filtering ListView in android?

Maintain a list of the selected items, and whenever the list is repopulated check if that id (not position) exists in the list, and set as selected.

Yes, this behaviour is because ListView holds the position as a reference to selected items. This means that even for adapters with stable IDs the selection is bound to the position (which has been filtered out in your case). As suggested, implement some custom map/set for holding IDs that are checked and feed them to the adapter.

Take for example three entries: 'A', 'B' and 'C' where 'C' is checked beforehand (i.e. The entry at position 3 in the list). When I type a 'C' on the keyboard, only the 'C' entry is displayed (as intended).

Now 'C' is not checked anymore, since the entry has moved from the checked position 3 to the unchecked position 1 in the list. This behavior leads to some not very welcome effects in the app. Is there a way to "move the selection with the filtering", i.e.

Bind the checked state to the entry and not to its initial position in the list? Or do I need to find a new approach?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions