Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Email Validation Code in Android

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 402
    Comment on it

    Email Validation Code in Android


    Almost on every login and Sign Up screen, you have to create email field and add email validation on it. Its a simple code for email validation.
    Here you have to call it first doing login or sign up.


    public static boolean checkValidEmail(EditText emailEditText,Context _context)
        {
            if(TextUtils.isEmpty(emailEditText.getText().toString())){
                emailEditText.setError(_context.getString(R.string.empty_filed));
                emailEditText.requestFocus();
                return false;
            }
            else if(!(emailEditText.getText().toString().contains("@")  && emailEditText.getText().toString().contains(".")))
            {
                emailEditText.setError(_context.getString(R.string.invalid_email));
                emailEditText.requestFocus();
                return false;
            }
            return true;
        } 

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: