How to set numeric virtual keyboard only for LWUIT TextField that constraint with Password and Numeric?

1k Views Asked by At

I want to set LWUIT TextField constraint to Number and Password. I make TextField by

TextField tf=new TextField();

tf.setConstraints(TextArea.NUMBER|TextField.PASSWORD);

tf.setInputModeOrder(new String[ ] {"123"} );

I use virtual keyboard for input to this textfield. When I press this textfiled, alphabat virtual keyboard appear and can type alphabat like a to z and other symbol.

How can I set this textfield that only appear numeric virtual keyboard?

1

There are 1 best solutions below

2
On

Use like this for both numeric and password in the TextField,

textField.setConstraint(TextArea.NUMERIC | TextField.PASSWORD);
textField.setInputModeOrder(new String[]{"123"});