I have two EditText views on my page. I want to rid them of the focus when I am not clicking on them. I can't get it to work. I tried this. I set this method to each view except EditTextView But this gets rid of only the cursor and the keyboard The view is still highlighted. Is there any lighter way to do this. Any suggestions.
public static void hideKeyboard(Activity activity) { InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE); EditText editText = (EditText) (activity.getCurrentFocus()); editText.setCursorVisible(false); inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0); }