I have a textinputedittext with input type=number. To close the keypad if user clicks anywhere other than textinputedittext i used the following function -
public static void hideSoftKeyboard(Activity activity) {
InputMethodManager inputMethodManager =
(InputMethodManager) activity.getSystemService(
Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(
activity.getCurrentFocus().getWindowToken(), 0);
}
But instead of keyboard getting closed , it simply converts to alpha-numeric(default) keyboard , and then when there is second click the the keyboard closes. I am unable to understand as to why the keyboard instead of closing converts to alpha-numeric.
android:focusableInTouchMode="false"
adding this attribute on parent layout of screen solved the issue.