Code example for SearchView

Methods: clearFocus

0
        } 
        return super.onOptionsItemSelected(item);
    } 
 
    @Override 
    public boolean onQueryTextSubmit(String query) {
        mSearchView.clearFocus();
        if(!query.equals(mLastSearchString)){
            mSearchFragment.doSearch(query);
        } 
        return false; 
    } 
 
    @Override 
    public boolean onQueryTextChange(String newText) {
        if(newText.length() > 1 && !Character.isWhitespace(newText.charAt(newText.length()-1))){
            mSearchFragment.doSearch(newText);
        } 
        mLastSearchString = newText;
        return false; 
    }