I want to make a BasicEditField that should only accept uppercase letters, lowercase letters and numeric values. It should not accept any other characters. Is there any bit of style for the BlackBerry BasicEditField that makes it work this way? If not, is there anything else I can do?
I use these methods: TextFilter # get and BasicEditField # setFilter
mEdit = new EditField(); mEdit.setFilter(TextFilter.get(TextFilter.NUMERIC));
or
// Numeric filter that also allows minus sign. mEdit.setFilter(TextFilter.get(TextFilter.INTEGER));
I think creating your own filter by overriding TextFilter can solve the more complex filtering problem.
, , . , , , . , , . API TextFilter. , . , . validate , a-z A-Z 0-9. true, false. .
BasicEditField ; BasicEditField AutoTextEditField. AutoTextEditField , . .
new AutoTextEditField("My label:", "initial value", 1024, 50, TextFilter.LOWERCASE | TextFilter.NUMERIC);
mEdit.setFilter(TextFilter.get(TextFilter.NUMERIC)); , , , , " " - "" .
, . , FILTER_UPPERCASE | FILTER_LOWERCASE | FILTER_NUMERIC.
setFilter TextFilter, , , . Convert , , .. Validate , . . API .
Kumar , , -
script , , .
setFilter(new TextFilter() { public boolean validate(char c) { return (Character.isDigit(c) || Character.isLowerCase(c) || Character.isUpperCase(c)); } public char convert(char c, int status) { return c; }}
Source: https://habr.com/ru/post/1721782/More articles:Compress xls content using apache deblate module - apache2размер файла резко увеличивается после рассола - pythonweb.config - automatically create release version - debuggingВ чем разница между jetspeed 2 и плутоном? - javaThe best approach to the action of a double state - javaAccessing a dynamically loaded DLL (using LoadLibrary) in Visual Basic 6 - windowsЯзыковые строки в URL-адресах - urlC # how to handle internet breaks - c #How to work with memory leak of a third-party DLL (without source code) accessed by the Tomcat application? - javaMixing Audio on iPhone - iphoneAll Articles