Jeremy Logan Jeremy Logan - 1 month ago 6
Android Question

Android on-screen keyboard auto popping up

One of my apps has an "opening screen" (basically a menu) that has an

EditText
followed by several
Button
s. The problem is that several of my users are reporting that when they open the app it's automatically popping up the on-screen keyboard without them even touching the
EditText
. As far as I can tell, all of these users are using the HTC Hero.

Is this a bug in 1.5? Is there anything I can do about it?

Answer

You can use the following line of code in the activity's onCreate method to make sure the keyboard only pops up when a user clicks into an EditText

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