I have a fragment containing an EditText for input, but now I want to close the keyboard when the user clicks on the screen outside of the EditText.
I know how to do this in an activity, but it seems to be different for fragments.
i am calling this method on view.onTouchListener
public static void hideSoftKeyboard() {
InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0);
}
anyone have solution, thanks
Use this method its works fine