首先应该去查JDK的帮助文档,上面是这样写的
public class NumberFormatExceptionextends IllegalArgumentException
当应用程序试图将字符串转换成一种数值类型,但该字符串不能转换为适当格式时,抛出该异常。
可以用如下办法解决:
String temp="0";
if(metCarMoney.getText().toString().trim().equals(""))
{
Toast.makeText(BuyCarFee.this,"请输入新车购置价!",Toast.LENGTH_LONG).show();
temp="0";
}
else
{
temp=metCarMoney.getText().toString();
}
dCarMoney=Double.parseDouble(temp);