fredag 11 maj 2012

How to prevent soft keyboard from showing up in Android

I had an app that consisted of a two AutoCompleteTextViews and a few other controls. As the text fields might have good default values, when the user opens the app, I wanted to hide the soft keyboard. To do that I finally found out that I should add

android:windowSoftInputMode="stateHidden"

to the activity tag in the AndroidManifest.xml. This worked fine even though the AutoCompleteTextView actually resided inside a Fragment hosted by the activity.