In my app login using mobile number or phone number in single edittext. if we give digits it check valid phone number else if we give character(alphabet) check it is valid email address.
Note : check both email and phone number in single edit text.
Here java code,
if (username.getText().toString().length() == 0) {
erroredit(username, getResources().getString(R.string.login_label_alert_username));
} else if (!isValidEmail(username.getText().toString().replace(" ","").trim())) {
erroredit(username, getResources().getString(R.string.login_label_alert_email_invalid));
} else if (!isValidmobilenumber(username.getText().toString().replace(" ","").trim())) {
erroredit(username, getResources().getString(R.string.register_label_alert_phoneNo));
}
else if (password.getText().toString().length() == 0) {
erroredit(password, getResources().getString(R.string.login_label_alert_password));
}
Attached screenshot here,