Invoking a search or filter on an Android ListFragment?
I’m using the Android compatibility library, and I’m using a ListFragment. I have it set up to display the items in my list quite nicely. However, now I want to give the users the ability to filter/search the data. How do I set this up? Is it any different then it was with the regular ListView? And if so, do I place all my code for that in the ListFragment, or the parent Activity?
One Solution collect form web for “Invoking a search or filter on an Android ListFragment?”
You need to have your Adapter implement Filterable interface, then override getFilter() method. Actually ArrayAdapter offers a simple Filtrable implementation, you can check out the ArrayAdapter source code to find out how it works.