Created
May 30, 2017 04:10
-
-
Save kalvian1060/eaac958d78ca919a38271e05b496a1a5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final EditText emailValidate = (EditText)findViewById(R.id.textMessage); | |
final TextView textView = (TextView)findViewById(R.id.text); | |
String email = emailValidate.getText().toString().trim(); | |
String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+"; | |
// onClick of button perform this simplest code. | |
if (email.matches(emailPattern)) | |
{ | |
Toast.makeText(getApplicationContext(),"valid email address",Toast.LENGTH_SHORT).show(); | |
} | |
else | |
{ | |
Toast.makeText(getApplicationContext(),"Invalid email address", Toast.LENGTH_SHORT).show(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment