I have EditField. I want to show virtual keyboard only with number, without letters. Is it possible?
4 Answers
editText.setInputType(InputType.TYPE_CLASS_NUMBER);

- 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
amount->setInputMode(bb::cascades::TextFieldInputMode::NumbersAndPunctuation);
You can find all the types here: https://developer.blackberry.com/cascades/reference/bb__cascades__textfieldinputmode.html

- 231
- 2
- 10
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).

- 5,025
- 4
- 30
- 35