EditField in Black Berry
I want to create the EditField
which allow Numeric Values, Comma and other valu开发者_如何学编程es are ignore in Blackberry.
So How I can achieve this by programming code ?
Thanks.
It can be achieved by using the EditField class with the Four arguments according to your need.
EditField ef = new EditField(0, "0", 3, EditField.FILTER_NUMERIC)
Add this field to a screen or a manager
The above code would make the field accept only the integer values. And if it is a Virtual keypad, it would not even show other characters/aplhabets on the keypad
Hope this solves your problem. Keep Coding Cheers !!
use filter for this.....
_numberEditField = new EditField(_name, "");
_numberEditField.setFilter(TextFilter.get(TextFilter.NUMERIC));
add(_numberEditField);
精彩评论