Skip to content
Advertisement

Prevent the keyboard from displaying on activity start

I have an activity with an Edit Text input. When the activity is initialized, the Android keyboard is shown. How can the keyboard remain hidden until the user focuses the input?

Advertisement

Answer

I think the following may work

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);

I’ve used it for this sort of thing before.

Advertisement