Winona Winona - 1 year ago 97
Android Question

Check if EditText is empty.

I have 5

in android for users to input. I would like to know if I could have a method for checking all the 5
if they are null. Is there any way to do this??

Answer Source

I did something like this once;

EditText usernameEditText = (EditText) findViewById(;
sUsername = usernameEditText.getText().toString();
if (sUsername.matches("")) {
    Toast.makeText(this, "You did not enter a username", Toast.LENGTH_SHORT).show();