How do you hide the keypad on activity change or when edit text is not enabled?
How do you hide the keypad?
I'm currently using the following code to hide the keypad. Is there a better way to do this?
Window window = getWindow();
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAY开发者_JAVA技巧S_HIDDEN);
You have the right idea for hiding the soft keyboard. You could probably use the SOFT_INPUT_STATE_HIDDEN flag instead of the ALWAYS_HIDDEN one, this would allow it so it will re-open when the user clicks in the EditText without the need to call setSoftInputMode() again.
精彩评论