SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(Menus.SEARCH));
searchView.setQueryHint(this.getString(R.string.search));
editSearch = (E
If you are using search dialog you can do something like this for Kotlin
override fun onOptionsItemSelected(item: MenuItem): Boolean {
val id = item.itemId
return if (id == R.id.search_button) {
val searchManager = this.getSystemService(Context.SEARCH_SERVICE) as SearchManager
searchManager.setOnDismissListener {
// return the activity to the normal state
}
// set activity to search state then request search
onSearchRequested()
} else super.onOptionsItemSelected(item)
}