Thursday 11 September 2014

hide keyboard android programmatically

hide keyboard android programmatically

To hide keyboard android programmatically use this code in onCreate ,before set contentview.

this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);


And also use following code to hide keyboard android when press button or something.

InputMethodManager imm = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
     imm.hideSoftInputFromWindow("set your edittext name ".getWindowToken(), 0);


No comments: