• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using Floating Point

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to J2ME and am trying to do a simple app for a blackberry. I am trying to read a user's input using a BasicEditField and then convert this to a float do some math and convert the float answer to a string and write back out again.

java:171: valueOf(java.lang.String) in java.lang.Float cannot be applied to (net.rim.device.api.ui.component.BasicEditField)
float cf = Float.valueOf(capf)

If I try to convert to a string first, I get the following error:
java:169: toString() in java.lang.Object cannot be applied to (net.rim.device.api.ui.component.BasicEditField)
String sx = toString(size);

Any suggestions on how to read input, do the math and write output?
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're going to have to get the VALUE stored in the BasicEditField. BasicEditField isn't a String, it's a UI control class.
 
reply
    Bookmark Topic Watch Topic
  • New Topic