Can anyone tell me what is wrong with this?
App crashes if user input is left blank. I was hoping it would display toast and wait for input.

                EditText userWireInput = (EditText) findViewById(R.id.WireSizeInputET);
                String userWireData = userWireInput.getText().toString();
               double userWire = Double.parseDouble(userWireData);

                if (userWire == 0) {

                    Toast.makeText(ISOM_Int_Results.this, "ENTER WIRE SIZE", Toast.LENGTH_LONG).show();
                    return;
            }

Recommended Answers

All 3 Replies

If it crashes the app, break point it and debug line by line. Knowing exactly which line causes the crash usually makes solving it quite easy.

@Centorpe you should have posted also error message...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.