BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 07-17-2008, 09:53 PM   #1
dynot
Thumbs Must Hurt
 
Join Date: Oct 2007
Location: montreal
Model: 8100
PIN: N/A
Carrier: rogers
Posts: 70
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
richard.puckett
Talking BlackBerry Encyclopedia
 
richard.puckett's Avatar
 
Join Date: Oct 2007
Location: Seattle, WA
Model: 9020
PIN: N/A
Carrier: T-Mobile
Posts: 212
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
Jasongk
New Member
 
Join Date: Jul 2008
Model: 8320
OS: 4.2.2.171
PIN: N/A
Carrier: Orange
Posts: 3
Default

have you tried String.valueOf(integer)
Offline  
Old 07-18-2008, 10:01 AM   #4
dynot
Thumbs Must Hurt
 
Join Date: Oct 2007
Location: montreal
Model: 8100
PIN: N/A
Carrier: rogers
Posts: 70
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
dynot
Thumbs Must Hurt
 
Join Date: Oct 2007
Location: montreal
Model: 8100
PIN: N/A
Carrier: rogers
Posts: 70
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


NEW NOVOTECHNIK TLH-0150 TLH 150 Position Transducer picture

NEW NOVOTECHNIK TLH-0150 TLH 150 Position Transducer

$160.00



Fukuda Pressure Transducer VR-55PT/TCD picture

Fukuda Pressure Transducer VR-55PT/TCD

$1049.95



FREQUENCY TRANSDUCER picture

FREQUENCY TRANSDUCER

$44.99



Lowrance PD - WBL Transducer 106 - 73 picture

Lowrance PD - WBL Transducer 106 - 73

$64.95



MTS LPRHVU00701 Temposonics Transducer Linear Position LPR-HVU-00701 90014868 picture

MTS LPRHVU00701 Temposonics Transducer Linear Position LPR-HVU-00701 90014868

$238.95



5V Pressure Transducer or Sender 30psi-1600Psi for Fuel Diesel Oil Air Water picture

5V Pressure Transducer or Sender 30psi-1600Psi for Fuel Diesel Oil Air Water

$20.43







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