Highlight filter search on RecycleView with Databinding and Kotlin Flow

vegeta
1 min readMar 14, 2022

Hi there !

Recently, I’m interested in highlight search on ListView so I tried to make a sample app for this.

First of all, what Android technical am I using on this sample app :
- Modular architecture
- Single activity
- MVVM, Databinding
- Kotlin Flow
- Clean architecture

So, let me explain very simple about function of app.
Reading the US presidents json file from asset (Basically It should be from API) → Passing → Show on List → Do a search → Filter and make highlight filter text

In order to using databinding for RecycleView , we need bind data to list with BindingAdapter.

Create BinableAdapter interface to set data to list

Binding data to RecycleView with BindingAdapters.kt

Binding list data to List

SearchViewModel.kt

Reading json file and make as Flow

Here is app

Leave comment here if you need full source code !
Happy coding !

--

--