-2

i tried to make a application which takes the numeric value default. i have done coding like this

public void startApp(){
Display.init(this);
TextField amt=new TextField();
Form form=new Form(Test);
form.addComponent(amt);
amt.setConstraint(TextField.NUMERIC);
form.show(); 

}

When i setConstraint to numeric. it only accepts numeric value but i need to press the hash key and chage the key entry style to numeric. so how can i make the text field which should only be able to take numeric input by default. thanks in adavance.

Bikesh
  • 91
  • 4
  • 13

1 Answers1

2

Use setInputModeOrder(...);. See the following sample code,

TextField txtf = new TextField();
txtf.setConstraint(TextField.NUMERIC);
txtf.setInputModeOrder(new String[] {"123"});
form.addComponent(txtf);
bharath
  • 14,283
  • 16
  • 57
  • 95