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

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.

Jump to Post

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 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.