BlackBerryForums.com : Your Number One BlackBerry Community   Wallpaper Megaplex for BlackBerry   

»Sponsored Links



Reply
 
LinkBack Thread Tools
  (#1 (permalink)) Old
dynot Offline
Knows Where the Search Button Is
 
Posts: 45
Join Date: Oct 2007
Model: 8100
PIN: N/A
Carrier: rogers
Default Why this NumberFormatException error? - 07-17-2008, 09:53 PM

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...
   
Reply With Quote
Sponsored Links
Please Login or Register to Remove these Advertisements!

  (#2 (permalink)) Old
richard.puckett Offline
Talking BlackBerry Encyclopedia
 
richard.puckett's Avatar
 
Posts: 212
Join Date: Oct 2007
Location: Seattle, WA
Model: 8800
PIN: N/A
Carrier: AT&T
Default 07-17-2008, 10:03 PM

What is NumStat? What value does it have?


Do your homework and know how to ask a good question.
   
Reply With Quote
  (#3 (permalink)) Old
Jasongk Offline
New Member
 
Posts: 3
Join Date: Jul 2008
Model: 8320
OS: 4.2.2.171
PIN: N/A
Carrier: Orange
Default 07-18-2008, 01:57 AM

have you tried String.valueOf(integer)
   
Reply With Quote
  (#4 (permalink)) Old
dynot Offline
Knows Where the Search Button Is
 
Posts: 45
Join Date: Oct 2007
Model: 8100
PIN: N/A
Carrier: rogers
Default 07-18-2008, 10:01 AM

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.
   
Reply With Quote
  (#5 (permalink)) Old
dynot Offline
Knows Where the Search Button Is
 
Posts: 45
Join Date: Oct 2007
Model: 8100
PIN: N/A
Carrier: rogers
Default 07-18-2008, 03:16 PM

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.
   
Reply With Quote
Reply


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




Wallpaper Megaplex for BlackBerry


Copyright © 2004-2008 BlackBerryNews.com, BlackBerryFAQ.com, BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of Research In Motion Limited.
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.1