How to filter text in a ListView properly?

前端 未结 1 544
无人及你
无人及你 2021-01-03 00:47

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 ListV

相关标签:
1条回答
  • 2021-01-03 01:23

    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

    0 讨论(0)
提交回复
热议问题