I'm making kind of a calculator and everything is working fine.
Except when I leave one of the 4 EditText fields blank, the
application cracks ("stops unexpectly").
How can I work this out?
It would be good to, when this happens (EditText blank) just put a
"empty" message at the destination.
Part of the code:
public void onClick(View arg0) {
double result = new
Double(input1.getText().toString())
* new Double(input3.getText().toString());
conta.setText(Double.toString(result));
double result2 = new
Double(input1.getText().toString())
* new Double(input3.getText().toString()) /
new Double(input4.getText().toString());
porpessoa.setText(Double.toString(result2));
double result3 = new
Double(input1.getText().toString())
* new Double(input2.getText().toString());
totallitros.setText(Double.toString(result3));
double result4 = new
Double(input1.getText().toString())
* new Double(input2.getText().toString())/
new Double(input4.getText().toString());
litrosporpessoa.setText(Double.toString(result4));
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en