I am having a problem with Edit Text empty text.
If email and password textfield is empty, then the TextUtils gonna show on both edittext.
If the user press the exclamation icon, then the message"This field is required" gonna show up. Other than that, its gonna be exclamation only.
Below is my code in ASIDE
etEmail = (EditText) findViewById(R.id.etEmail);
etPassword = (EditText) findViewById(R.id.etPassword);
String email = etEmail.getText().toString().trim();
String password = etPassword.getText().toString().trim();
if(TextUtils.isEmpty(email)&& TextUtils.isEmpty(password)) {
etEmail.setError("This field is required");
return;
}
else if(TextUtils.isEmpty(email)) {
etEmail.setError("This field is required");
return;
}
else if(TextUtils.isEmpty(password)) {
etPassword.setError("This field is required");
return;
}
else{
}