Android - Filter list with Groupie Library

929 views Asked by At

I previously had a custom recycler adapter class that implemented Filterable to enable me to filter an item list by the user entered text string.

I have recently migrated to using the Groupie library for my lists for ease of use. How can I implement this filtering feature using Groupie considering that you only deal with a single item at a time, rather than a list?

If examples or further details are required, let me know.

Thanks.

1

There are 1 answers

0
Valentin On

What I suggest you do is keep a reference to list of filterable Items you pass to your adapter. Then, whenever you want to apply a filter just call myListOfItems.filter { myFilterFunc(it) } (Kotlin example) and pass the filtered list of items to your adapter.