Search code examples
androidkeyboardcodenameone

Automatically opening the keyboard in Codename One


I need to automatically open the numeric keyboard to facilitate entering an access PIN. I've tried giving focus to the textfield (textField.requestFocus();), but it hasn't worked.

I tried:

Display.getInstance().editString(textField.getText(), Display.INPUT_TYPE_NUMERIC);

Without success.


Solution

  • Use textField.startEditingAsync() or if it's a new form that you're showing use form.setEditOnShow(field).