Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 11:58, 16 April 2008.

KIJ000873 - Value of TextField.NUMERIC is limited to 10 digits in Series 40

From Forum Nokia Wiki


ID KIJ000873 Creation date April 2, 2008, updated April 16, 2008 
Platform All Series 40 Editions  Devices All Series 40 devices 
Category Java ME  Subcategory MIDP 2.0 

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.

Related Discussions
Thread Thread Starter Forum Replies Last Post
Textfield key stroke detection sevics Mobile Java General 2 2004-12-17 20:38
Cannot use textField after delete and insert in Form andretr Mobile Java Tools & SDKs 1 2004-08-03 13:33
Can you recommend a developer friendly Nokia phone ? lbk003 Mobile Java General 5 2003-12-11 13:24
Localisation problem mleal General Symbian C++ 1 2002-11-01 08:58
Contact name problem chairma General Discussion 3 2006-04-04 07:48
 
Powered by MediaWiki