hide keyboard programmatically android code example
Example 1: How to programmatically hide Android soft keyboard
private void closeSoftKeyboard()
{
View v = this.getCurrentFocus();
if (v != null) {
InputMethodManager inputManager
= (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
}
Example 2: android activity keyboard hide
<activity android:name="com.your.package.ActivityName"
android:windowSoftInputMode="stateHidden" />