Email and phone Number Validation in android

后端 未结 12 1250
青春惊慌失措
青春惊慌失措 2020-12-02 11:03

I have a registration form in my application which I am trying to validate. I\'m facing some problems with my validation while validating the phone number and email fields.<

12条回答
  •  [愿得一人]
    2020-12-02 11:45

    I am always using this methode for Email Validation:

    public boolean checkForEmail(Context c, EditText edit) {
        String str = edit.getText().toString();
        if (android.util.Patterns.EMAIL_ADDRESS.matcher(str).matches()) {
            return true;
        }
        Toast.makeText(c, "Email is not valid...", Toast.LENGTH_LONG).show();
        return false;
    }
    

提交回复
热议问题