akki
akki

Reputation: 405

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_ALWAYS_HIDDEN);

Upvotes: 0

Views: 107

Answers (1)

FoamyGuy
FoamyGuy

Reputation: 46856

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.

Upvotes: 1

Related Questions