I created a BasicEditField in Blackberry and added a NumericTextFilter (set to REAL_DECIMAL). It does what I expect (allows negative and decimal). However, I want to allow one more character, that is 'e'. E.g. 1.234e5, which is equal to 1.234x10^5. Well, looking at my example, RIM should agree that '1.234e5' is a real decimal.
I just want to ask if anyone here has a suggestion on how I can allow 'e' here?
I believe 1.234e5 and even 1.234e-5 is parseable by Double.
开发者_JS百科Many thanks
EDIT: by the way, I am using Blackberry OS 5.0.
I think you will need to implement your own subclass of TextFilter or NumericTextFilter if you want to support numbers in "scientific notation". According to the javadoc, NumericTextFilter only understands numbers consisting of decimal digits and (depending on the flags) a decimal point and/or leading minus sign.
精彩评论