Reputation: 579
I have a variable from xml:
editTextInput = (EditText) findViewById(R.id.editTextInput);
When the application loads the keyboard is shown, but I want to hide it, and if the user want to have it back she has to click on the EditText-field to display it.
Upvotes: 1
Views: 93
Reputation: 13808
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Upvotes: 2
Reputation: 230
This should work:
InputMethodManager inputManager =
(InputMethodManager) context.
getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(
this.getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
Upvotes: 0