I don't know if this is talked about here since it is mobile development. But I am taking a class in jave me and am having problems parsing a string to a double in the following code:
Code:
public void convertTemperature()
{
double result;
TextField num = new TextField("Enter the number of units you would like to convert", "", 50, TextField.ANY);
ui_form.append(num);
str = num.getString();
try
{
numUnits = Double.parseDouble(str);
}
catch (NumberFormatException nfe)
{
}
//double fromNum = Double.parseDouble(str);
TemperatureConverter c = new TemperatureConverter("Celsius", "Fahrenheit", "This is a temp converter",
"Temperature converter", "Temp");
result = c.convertCF(numUnits);
res = "" + result;
}//End convertTemp()
for some reason it is always parsing it as a 0. Can you see anything wrong with this code?