I need to get a String from searchView on ToolBar for filtering, I complete the filtering but ı can’t get the String from ToolBar.
Here is my searchView
<item
android:title="Search"
android:id="@+id/menu_search"
android:icon="@android:drawable/ic_menu_search"
app:showAsAction="always|collapseActionView"
app:actionViewClass="androidx.appcompat.widget.SearchView"
/>
Here is my RecylerAdapter
val userInput: String = ""
val filteredList: List<Book> = bookList.filter {
it.bookName.contains(userInput)
}
So I need userInput.