I have an activity where there is an EditText and on enter key search results are shown, so what I simply want to do is to close the keyboard when search results are about to show to prevent the user from having to do it. However if the user wants to refine his search the keyboard should open back up if he taps into the EditText again.
This has been more difficult than I imagined, I've been search and tried a few things most don't even close the keyboard on my HTC, one method where the InputType is set to INPUT_NULL closes the keyboard but it doesn't open afterwards.
Any suggestions on how to do this?
@Override
public boolean onQueryTextSubmit(String query) {
// Your search methods
searchView.clearFocus();
return true;
}
Straight to the point and clean.