[Solved] What happens when EditText has a null? [closed]


If the EditText has no contents, it will return a blank string, or a “” In order to return with 0, simply set up an if statement:

EditText editText = (EditText) mParent.findViewById(Rid_something);
String string = editText.getText().toString().trim();
if (string.equals("")) {
    return "0"; 
} else {
    return string;
}

This will return 0 if blank, or the contents if not.

1

solved What happens when EditText has a null? [closed]