blackberryblackberry-simulatorblackberry-editfield

EditField in Black Berry


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.


Solution

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