Android Listview Search Filter
I am trying to make a list view search for Android. I have found many tutorials that do just that where a search-bar is placed at the top and if you type in the box the results ge
Solution 1:
Rather than products[position]
, use adapter.getItem(position)
. When the ListView
is not in filter mode, those two things will be the same. But, in filter mode, getItem()
will take the filtering into account.
Solution 2:
The ListAdapter will change the relative position of the items it currently shows due to the filtering. You should always use getItem(position)
to retrieve the correct item.
Post a Comment for "Android Listview Search Filter"