I have this in xml.
<EditText
android:id="@+id/creditlimitfield2"
android:hint="0"
android:inputType="numberDecimal" />
So, the default value for edittext is 0.
in code, I have this
creditlimit = (EditText) findViewById(R.id.creditlimitfield2);
double credit_limit = Double.valueOf(creditlimit.getText().toString());
Alternately, I have tried:
double credit_limit = Double.parseDouble(creditlimit.getText().toString());
And
double credit_limit = new Double(creditlimit.getText().toString());
When I run the program, It gives the error of
Numberformatexception. Invalid double "".
Please be reminded that the field is not empty. Any suggestions would be helpful.
I have seen many questions,almost similar to it, with very less answers and none of them help solving my condition. So, Please do not tag it as "Similar Question" without checking other questions too.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…