【发布时间】:2013-04-17 11:49:49
【问题描述】:
public static int convertCelsiusToFahrenheit(Long celcious){
return Math.round(celcious * 9/5 + 32);
}
我正在尝试将其设置为我的 TextField。我无法在Text Field 中设置值,因为我得到了 NumberFormatException。 我怎样才能用精度值发送它。
holder.textItem.setText(convertCelsiusToFahrenheit(Long.parseLong(
custom.getTemperature())));
java.lang.NumberFormatException:无效长:“32.2222222222222”
【问题讨论】:
-
看来你需要
Double或double这里。 -
Long是整数类型,所以"32.2222"无效。