Skip to content Skip to sidebar Skip to footer

How To Filter Text In A Listview Properly?

I've tried to filter my ListView from my EditText box, but currently, it's not working. I have a ListView that get data properly and they are added to my own ListView using a Array

Solution 1:

The built-in filter implemented by ArrayAdapter converts the contained object to string by calling toString() method. It is this string that will be used to perform the matching. If you are only trying to match one string field in your Order object, you can override the toString() method for your Order class to return that field. If you want to perform more flexible matching, such as matching multiple fields, check out this post which shows how to create a custom filter:

Custom filtering in Android using ArrayAdapter

Post a Comment for "How To Filter Text In A Listview Properly?"