I have an EditText
field which is disabled at the beginning.
I would like to set it to enabled, put the cursor on it and the keyboard should be visible.
I tried the following code and all works - only the keyboard will not be shown.
@Override protected void onCreate(Bundle savedInstanceState{ editText.setEnabled(true); editText.requestFocus(); getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT); }
For hiding keyboard:
InputMethodManager imm = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
For Showing keyboard:
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With