Seems like the String in editText2 is empty, so it fails to parse it as float.
A possible solution is to check if the String is empty first, and then decide about default value, another is to catch the exception:
float from_value;
try {
from_value = Float.parseFloat(editText2.getText().toString());
}
catch(NumberFormatException ex) {
from_value = 0.0; // default ??
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…