case R.id.btnPlus:
if(tvResult.getText().toString().equals(null))
{
num1 = Double.valueOf("0");
} else{
// num1 = Double.valueOf(tvResult.getText().toString());
num1 = Double.parseDouble(tvResult.getText().toString());
}
tvResult.setText(R.string.btnPlus);
type = 1;
break;
写一个简单计算器,这段代码当我TextView内容为空时报错java.lang.NumberFormatException: Invalid double: "",但是我已经用了判断了啊,不为空时才会gettext啊,不懂为什么出错???
if(tvResult.getText().toString().equals(null))
{
num1 = Double.valueOf("0");
} else{
// num1 = Double.valueOf(tvResult.getText().toString());
num1 = Double.parseDouble(tvResult.getText().toString());
}
tvResult.setText(R.string.btnPlus);
type = 1;
break;
写一个简单计算器,这段代码当我TextView内容为空时报错java.lang.NumberFormatException: Invalid double: "",但是我已经用了判断了啊,不为空时才会gettext啊,不懂为什么出错???