1

I have EditField. I want to show virtual keyboard only with number, without letters. Is it possible?

Michael Donohue
  • 11,776
  • 5
  • 31
  • 44
Tim
  • 1,606
  • 2
  • 20
  • 32

4 Answers4

2
editText.setInputType(InputType.TYPE_CLASS_NUMBER);
wasyl
  • 3,421
  • 3
  • 27
  • 36
  • I'm confused - I can't seem to find the setInputType method in the BB 7.0.0 API? Can you post a link to the documentation? – Wayne Uroda Mar 15 '13 at 00:20
1

You can also use

object.setFilter(TextFilter.get(TextFilter.NUMERIC));
Kay
  • 51
  • 6
0

amount->setInputMode(bb::cascades::TextFieldInputMode::NumbersAndPunctuation);

You can find all the types here: https://developer.blackberry.com/cascades/reference/bb__cascades__textfieldinputmode.html

BrandonO
  • 231
  • 2
  • 10
0

You can either construct the EditField and pass EditField.FILTER_NUMERIC as the style: http://www.blackberry.com/developers/docs/7.0.0api/net/rim/device/api/ui/component/BasicEditField.html#FILTER_NUMERIC

OR

You can call EditField.setFilter() http://www.blackberry.com/developers/docs/7.0.0api/net/rim/device/api/ui/component/BasicEditField.html#setFilter(net.rim.device.api.ui.text.TextFilter) and pass in aTextFilter. Use the static TextFilter.get() function and pass in one of the filter constants from the TextFilter class, eg http://www.blackberry.com/developers/docs/7.0.0api/net/rim/device/api/ui/text/TextFilter.html#NUMERIC

Numeric filters accept non-negative integers only (0 - 999999999 and beyond), Integer filter accepts all integers negative, zero and positive, and REAL_NUMERIC accepts any decimal number (negative, zero, positive, with an optional decimal point).

Wayne Uroda
  • 5,025
  • 4
  • 30
  • 35