user2615467
user2615467

Reputation: 47

How to filter ListView set by class with EditText?

I have a ListView that populates with items from ArrayList<myClass>. I have a layout and custom adapter and they show up just fine. myClass has two textviews in. I am wondering how I can filter out results by checking if what a user types in the edittext matches either of the textviews in the myClass class. I tried this solution, but it failed because I am using classes to fill my listview, not strings. Help is greatly appreciated.

Upvotes: 0

Views: 56

Answers (1)

Andrew Schuster
Andrew Schuster

Reputation: 3229

Take a look at the documentation for SearchView. It's got some useful capabilities. All you need to do is add on a OnQueryTextListener and you'll be well on your way to manipulating a ListView.

Upvotes: 1

Related Questions