Appcelerator Blog

The Leading Resource for All Things Mobile

Developer Tip: Managing the Android Soft Keyboard

40 Flares 40 Flares ×

The Android soft keyboard will display when an input field, such as textField, is in focus (e.g. a finger touch in the textField is sensed by the device). Normally, this is the behavior we want.

However, what if the first screen of your app is a login screen? Then we may not want the keyboard to launch as it may obscure information on the screen that we want the user to see before logging in.

Android Keyboard

In this case, the reason the keyboard launches immediately is because in the screen above, the textField is the first focusable field on the screen and that is where the focus will be.

If we want to keep the soft keyboard hidden, then we can set the windowSoftInputMode property of the Window to Titanium.UI.Android.SOFT_INPUT_STATE_HIDDEN as follows:

'Window[platform=android]': {
    windowSoftInputMode: Titanium.UI.Android.SOFT_INPUT_STATE_HIDDEN
}

Then we will get the desired behavior.

Android Keyboard 2

40 Flares Twitter 0 Facebook 0 Google+ 1 LinkedIn 39 Email -- 40 Flares ×

4 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. I am no longer able to get a keyboard to pop up in android apps. Anyone else experience this?

    • 63ek

      Basically Android show a keyboard by default when an application screen contains a textField. It is not convenient for the login page.

      • Leor

        63ek – correct but it also applies to other types of screens like a form with an input field on top. Really anytime the user is presented with a keyboard and you don’t want it displayed by default

    • Leor

      Harrington, on device or in simulator? Did it work before you set this property? You can always revert by removing the property setting.

Sign up for updates!

Become a mobile leader. Take the first step to scale mobile innovation throughout your enterprise.
Get in touch
computer and tablet showing Appcelerator software
Start free, grow from there.
40 Flares Twitter 0 Facebook 0 Google+ 1 LinkedIn 39 Email -- 40 Flares ×