what is the coding of email address validation using C# in xamarin.android visual studio 2015 and also tell me if any name space is requried? please tell me all the imp step as well as coding for email address validation in edittext. i am new in android.xamarin.. guys please help me
You can use Regex for email validation.
First add following using statement
using System.Text.RegularExpressions;
And after that use following helper method for validation:
Regex EmailRegex = new Regex (@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
public bool ValidateEmail(string email)
{
if (string.IsNullOrWhiteSpace(email))
return false;
return EmailRegex.IsMatch(email);
}
Option 2:
Xamarin.Android
has a helper method for email validation you also use that:
Android.Util.Patterns.EmailAddress.Matcher(email).Matches();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With