views:

177

answers:

2

I want a BasicEditField that lets me enter alphabets only...and a combination of upper case and lower case ...as in Jan, Feb...when i use the upper case and lower case filter that are there in BaiscEditField it allows either the entire string to be in upper case or lowr case ..not a combination..how do i achiever this...?

A: 

You may always sub-class from TextFilter and write such a filter.

Richard
+1  A: 

Richard's right, extend TextFilter, UPDATE according to Marc's suggestion:

 class AlphaTextFilter extends TextFilter {

    public char convert(char c, int status) {
        if (!validate(c))
            return 0;
        return c;
    }

    public boolean validate(char c) {
        return CharacterUtilities.isLetter(c);
    }
}

Then simply use

BasicEditField.setFilter(new SimpleTextFilter());

See also BlackBerry Support Community Forums:Java Development:Input Text Validation

Max Gontar
will this filter work when the program is run on a device with some other language....i mean will the char's be mapped automatically..if not please let me know how to make this localized...
Kaddy