Skip to content Skip to sidebar Skip to footer

Show Error Message On Searchview

I'm using a SearchView in the ActionBar and I'd like to know if it's possible to show an error if the input is invalid, similar as EditText's showError() method. I know that this c

Solution 1:

Try this.

int id = searchView.getContext()
                        .getResources()
                        .getIdentifier("android:id/search_src_text", null, null);
EditText editText = (EditText) searchView.findViewById(id);
editText.setError("Your error message");

Post a Comment for "Show Error Message On Searchview"