Trying to catch a null or 0 input. If a null input is made, the app crashes, if a 0 is input, it passes through the error and returns strange math!
case_cost = (EditText) findViewById(R.id.case_cost);
dilution = (EditText) findViewById(R.id.dilution);
answer =(TextView) findViewById(R.id.answer);
ounces_pc = (TextView) findViewById(R.id.ounces_pc);
Button finishBtn = (Button) findViewById(R.id.button3);
finishBtn.setOnClickListener (new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Method
if (((Float.valueOf(dilution.getText().toString())) == 0) ||
(dilution.getText().equals(null))) {
String errMsg = "Missing Dilution";
answer.setText(errMsg);
} else;
Debug Info:
StringToReal.invalidReal(String, boolean) line: 63
StringToReal.parseFloat(String) line: 289
Float.parseFloat(String) line: 300
Float.valueOf(String) line: 337
UccActivity$1.onClick(View) line: 47
Button(View).performClick() line: 4102
View$PerformClick.run() line: 17063
Handler.handleCallback(Message) line: 615
ViewRootImpl$ViewRootHandler(Handler).dispatchMessage(Message) line: 92
Looper.loop() line: 155
ActivityThread.main(String[]) line: 5454
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not
available [native method]
Method.invoke(Object, Object...) line: 511
ZygoteInit$MethodAndArgsCaller.run() line: 1029
ZygoteInit.main(String[]) line: 796
NativeStart.main(String[]) line: not available [native method]
Thread [<10> Binder_2] (Running)
Thread [<9> Binder_1] (Running)"