Issue
This code accepts either one, what i need is for both of them to be checked and return. Where am i making the mistake?
if(!email.endsWith(".com") && !email.contains("@")) {
Toast.makeText(view.context,
"Please enter a correct email", Toast.LENGTH_SHORT).show();
Solution
Just change the AND to a OR.
if(!email.endsWith(".com") || !email.contains("@")) {
Toast.makeText(view.context,
"Please enter a correct email", Toast.LENGTH_SHORT).show();
Answered By - Johan Nordlinder
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)