Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (keyboard)
Viewing all articles
Browse latest Browse all 352

Android: keyboard closes on "Next" button press

$
0
0

I have a series of text fields, and when I focus on the first one, the soft keyboard opens and then immediately closes. If I then tap on the second one, the keyboard opens and stays open, and I can go back to the first one and it stays open and everything is fine.

Text fields are created like this:

obj.softKeyboardOnFocus = Titanium.UI.Android.SOFT_KEYBOARD_SHOW_ON_FOCUS;
        obj.height = 40;
        obj.width = 200;
        obj.left = 4;
        obj.top = 3;
        obj.autocorrect = false;
        obj.autocapitalization = Titanium.UI.TEXT_AUTOCAPITALIZATION_NONE;
        obj.focusable = true;
        //obj.clearButtonMode = Titanium.UI.INPUT_BUTTONMODE_ONFOCUS;
        obj.keyboardType = Titanium.UI.KEYBOARD_URL;
        if (Titanium.Platform.displayCaps.platformWidth > 320) {
            obj.font = {
                fontSize : getAndroidNumbers(16, 22)
            };
            obj.top = getAndroidNumbers(3, 4);
            obj.height = getAndroidNumbers(40, 60);
            obj.width = getAndroidNumbers(200, 200);
        }
 
 
    var tf = Titanium.UI.createTextField(obj);
I also added listeners to all but the last edit field to fix a problem where the keyboard wasn't opening at all:
prevTf.addEventListener('return',function(){
            Ti.API.debug("return event listener firing for " + tag);
             tf.focus();
         });
prevTf is the previous text field in the list and tf is the current one, so when return ("Next") is clicked on one field, the next one is focused (and the keyboard stays open). Previously when Next was clicked focus would change to the next field, but the keyboard would close. Now Next is working, but the first field won't keep the keyboard open. Any ideas?

Viewing all articles
Browse latest Browse all 352

Trending Articles