4

Is it possible to get the current input type (text or numbers) from keyboard? Or is there an event that is triggered when input type is changed? I need to set input type on a screen based on what input type was when user exited that screen. Thanks

Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
Buda Gavril
  • 21,409
  • 40
  • 127
  • 196

1 Answers1

2
editText.getInputType();

These method return the Input type of the of the EditTextBox in integer format.

you can get the of all the InputTyp by using InputType interface like this way

InputType.TYPE_CLASS_NUMBER;
InputType.TYPE_CLASS_TEXT;
Pratik
  • 30,639
  • 18
  • 84
  • 159
  • do you know why if I set editText.setInputType(InputType.TYPE_CLASS_TEXT) and whyle keyboard is up, I change from keyboard to show numbers, on editText.getInputType() I get 1 (InputType.TYPE_CLASS_TEXT) and not 2 (InputType.TYPE_CLASS_NUMBER) ? – Buda Gavril Sep 12 '11 at 09:50
  • as you set as CLASS_TEXT and you enter the number it will consider as Text and you get number as CLASS_TEXT. but if you set as CLASS_NUMBER and enter number then only you can get CLASS_NUMBER. – Pratik Sep 12 '11 at 09:57