How to hide Android soft keyboard on EditText
This will help you
editText.setInputType(InputType.TYPE_NULL);
Edit:
To show soft keyboard, you have to write following code in long key press event of menu button
editText.setInputType(InputType.TYPE_CLASS_TEXT);
editText.requestFocus();
InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.showSoftInput(editText, InputMethodManager.SHOW_FORCED);
You need to add the following attribute for the Activity
in your AndroidManifest.xml
.
<activity
...
android:windowSoftInputMode="stateHidden|adjustResize"
...
/>