BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 07-17-2008, 09:53 PM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Oct 2007
Location: montreal
Model: 8100
PIN: N/A
Carrier: rogers
Posts: 70
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Why this NumberFormatException error?

Please Login to Remove!

Anyone know why I'm getting this NumberFormatException error from this 2-line code?

String cNorm = "" + ((1.5 * (NumStat - 1) * 10) - 15);
resultsField.setText(cNorm);

I also tried this but got the same error:

double t = ((1.5 * (NumStat - 1) * 10) - 15);
String cNorm = "" + Double.toString(t);
resultsField.setText(cNorm);

I checked the Sun Java Tutorials and tried all the various methods to convert the calculation to a string but they all give me the same error. I just want to display that result in a text field.

Thanks for any help...
Offline  
Old 07-17-2008, 10:03 PM   #2 (permalink)
Talking BlackBerry Encyclopedia
 
richard.puckett's Avatar
 
Join Date: Oct 2007
Location: Seattle, WA
Model: 9020
PIN: N/A
Carrier: T-Mobile
Posts: 212
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

What is NumStat? What value does it have?
__________________
Do your homework and know how to ask a good question.
Offline  
Old 07-18-2008, 01:57 AM   #3 (permalink)
New Member
 
Join Date: Jul 2008
Model: 8320
OS: 4.2.2.171
PIN: N/A
Carrier: Orange
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

have you tried String.valueOf(integer)
Offline  
Old 07-18-2008, 10:01 AM   #4 (permalink)
Thumbs Must Hurt
 
Join Date: Oct 2007
Location: montreal
Model: 8100
PIN: N/A
Carrier: rogers
Posts: 70
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by richard.puckett View Post
What is NumStat? What value does it have?
Darn it! That may be it. Its an integer between 2 and 8. I'll try changing that to double when I'm home tonight and report back.

Jansongk: yes, I tried that and got the same error.


You guys are great. Thanks a bunch.
Offline  
Old 07-18-2008, 03:16 PM   #5 (permalink)
Thumbs Must Hurt
 
Join Date: Oct 2007
Location: montreal
Model: 8100
PIN: N/A
Carrier: rogers
Posts: 70
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yep, that's what the problem was. NumStat was declared as an integer & I just changed that to double. Works like a charm now. Noobie mistake.

Thanks again richard.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Semiconductor 3000ea REEL AO8807L Alpha & Omega MOSFET 2P-CH 12V 6.5A 8TSSOP
$85.0
Semiconductor 3000ea REEL AO8807L Alpha & Omega MOSFET 2P-CH 12V 6.5A 8TSSOP pictureMini DC12V Semiconductor Refrigeration Pet Refrigerated Air Conditioner Cooler
$26.99
Mini DC12V Semiconductor Refrigeration Pet Refrigerated Air Conditioner Cooler picture1) Vintage NOS GE 1N4154 DIODE Semiconductor Products New Old Stock Original Box
$6.0
1) Vintage NOS GE 1N4154 DIODE Semiconductor Products New Old Stock Original Box pictureTestpoint 1 Accuprobe Semiconductor Test Probe 2003C
$776.0
Testpoint 1 Accuprobe Semiconductor Test Probe 2003C pictureLot of 10 NEW IXYS SEMICONDUCTOR CS45-16IO1 THYRISTOR PHASE 1600V TO-247AD ROHS
$20.0
Lot of 10 NEW IXYS SEMICONDUCTOR CS45-16IO1 THYRISTOR PHASE 1600V TO-247AD ROHS picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.