×
Namespaces

Variants
Actions
Revision as of 07:36, 9 August 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Value of TextField.NUMERIC is limited to 10 digits in Series 40 (Known Issue)

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): All Series 40 devices
CompatibilityArticle
Created: User:Technical writer 1 (April 2, 2008, updated April 16, 2008)
Last edited: hamishwillee (09 Aug 2013)

Contents

Overview

In Series 40, the value of TextField.NUMERIC must not exceed the value of 2147483646 (Integer.MAX_VALUE-1), otherwise an IllegalArgumentException is thrown.

Description

The integer value inserted in TextField defined with the TextField.NUMERIC constraint must not exceed the value of 2147483646 (i.e. Integer.MAX_VALUE-1) in Series 40, otherwise an IllegalArgumentException is thrown. In S60, this value may be exceeded without the exception.

How to reproduce

Use, for example, the following piece of code to reproduce this issue:

   TextField textField = new TextField("Enter Number:", "", 10, TextField.NUMERIC);
long n = Integer.MAX_VALUE;
textField.setString(Long.toString(n));
System.out.println("OK for Integer.MAX_VALUE, i.e. " + n);
try {
textField.setString(Long.toString(++n));
}
catch (IllegalArgumentException e) {
System.out.println("FAILED for Integer.MAX_VALUE + 1, i.e. " + n);
}


Solution

Avoid using values starting from Integer.MAX_VALUE and higher with the TextField.NUMERIC constraint in Series 40.

This page was last modified on 9 August 2013, at 07:36.
97 page views in the last 30 days.
×