EditField in Black Berry

149 Views Asked by At

I want to create the EditField which allow Numeric Values, Comma and other values are ignore in Blackberry.

So How I can achieve this by programming code ?

Thanks.

2

There are 2 best solutions below

0
On BEST ANSWER

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 !!

0
On

use filter for this.....

_numberEditField = new EditField(_name, "");
_numberEditField.setFilter(TextFilter.get(TextFilter.NUMERIC));
add(_numberEditField);