One of my apps has an "opening screen" (basically a menu) that has an
EditText followed by several
Buttons. 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?
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
<application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".Main" android:label="@string/app_name" android:windowSoftInputMode="stateHidden" >
This works for Android 3.0, 3.1, 3.2, 4.0 - Editor Used to Compile (Eclipse 3.7)
Place the 'windowSoftInputMode="stateHidden"' in your application's manifest XML file for EACH activity that you wish for the software keyboard to remain hidden in. This means the keyboard will not come up automatically and the user will have to 'click' on a text field to bring it up. I searched for almost an hour for something that worked so I thought I would share.