Share the post "Reset SearchView Programmatically In Android"
You only need to set 2 lines of code in order for the SearchView to be reset to its iconified state.
These are:
|
1 2 |
searchView.setQuery("", false); searchView.setIconified(true); |
The first line empties the EditText field while the second line hides the SearchView component and shows the MenuItem icon back.
That’s all!