How can we perform Email Validation on edittext in android ? I have gone through google & SO but I didn’t find out a simple way to validate it.
How can we perform Email Validation on edittext in android ? I have gone
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To perform Email Validation we have many ways,but simple & easiest way are two methods.
1- Using
EditText(....).addTextChangedListenerwhich keeps triggering on every input in anEditText boxi.e email_id is invalid or valid2- Simplest method using
if-elsecondition. Take the EditText box string using getText() and compare with pattern provided for email. If pattern doesn’t match or macthes, onClick of button toast a message. It ll not trigger on every input of an character in EditText box . simple example shown below.