本文整理汇总了Java中android.util.Patterns.EMAIL_ADDRESS属性的典型用法代码示例。如果您正苦于以下问题:Java Patterns.EMAIL_ADDRESS属性的具体用法?Java Patterns.EMAIL_ADDRESS怎么用?Java Patterns.EMAIL_ADDRESS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.util.Patterns
的用法示例。
在下文中一共展示了Patterns.EMAIL_ADDRESS属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUserEmail
private ArrayList<String> getUserEmail(){
ArrayList<String> email = new ArrayList<String>();
Pattern emailPattern = Patterns.EMAIL_ADDRESS; // API level 8+
Account[] accounts = AccountManager.get(VerifyOTP.this).getAccounts();
for (Account account : accounts) {
if (emailPattern.matcher(account.name).matches()) {
String possibleEmail = account.name;
if(possibleEmail != null)
if(possibleEmail.length() !=0 ){
email.add(possibleEmail);
}
}
}
return email;
}
示例2: validateEmail
/**
* @author Soussi
*
* @param email
* Function Checks for validity Email and return true or false
*/
private static boolean validateEmail(String email) {
Pattern patternEmail = Patterns.EMAIL_ADDRESS;
if (TextUtils.isEmpty(email))
return false;
matcher = patternEmail.matcher(email);
return matcher.matches();
}
示例3: getDeviceEmailAddress
public static String getDeviceEmailAddress(Activity activity) {
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
if (ActivityCompat.checkSelfPermission(activity, Manifest.permission.GET_ACCOUNTS) != PackageManager.PERMISSION_GRANTED) {
return "";
}
Account[] accounts = AccountManager.get(activity).getAccounts();
for (Account account : accounts) {
if (emailPattern.matcher(account.name).matches()) {
return account.name;
}
}
return "";
}
示例4: getMailByAccountManager
public static String getMailByAccountManager(Context context) {
AccountManager accManager = AccountManager.get(context);
Pattern gmailPattern = Patterns.EMAIL_ADDRESS;
Account acc[] = accManager.getAccountsByType("com.google");
for (Account account : acc) {
if (gmailPattern.matcher(account.name).matches()) {
return account.name;
}
}
WebtrekkLogging.log("could not get valid Account Email, check Permissions. Account:"+ Arrays.toString(accManager.getAccounts()));
return "";
}
示例5: isEmailCorrect
private boolean isEmailCorrect(String email) {
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
return emailPattern.matcher(email).matches();
}
示例6: isEmailCorrect
private boolean isEmailCorrect(String email) {
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
return emailPattern.matcher(email).matches();
}
示例7: onClick
@Override
public void onClick(View v)
{
nameValue = name.getText().toString();
emailvalue = email.getText().toString();
phoneValue = phone.getText().toString();
messageValue = message.getText().toString();
Log.d("mylog",nameValue+messageValue);
int flagName=0, flagEmail=0, flagMsg=0, flagPhone=0;
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
Pattern phonePattern = Patterns.PHONE;
boolean emailVal= emailPattern.matcher(emailvalue).matches();
boolean phoneVal =phonePattern.matcher(phoneValue).matches();
if(emailVal!=true)
{
email.setError("Invalid Email");
flagEmail=0;
}
else
{
flagEmail=1;
}
if(phoneVal==false)
{
phone.setError("Please enter your phone correctly ");
flagPhone=0;
}
else
{
flagPhone=1;
}
if(nameValue==null || nameValue.equals(" ") || nameValue.equals(""))
{
name.setError("Please enter your name");
flagName=0;
}
else
{
flagName=1;
}
if(messageValue.isEmpty())
{
message.setError("Please enter the message");
flagMsg=0;
}
else
{
flagMsg=1;
}
if (flagEmail==1 && flagPhone==1 && flagMsg==1 && flagName==1)
{
String s= String.valueOf(flagMsg+flagEmail+flagName+flagPhone);
//Log.d("hello",s);
FeedBackSend feedBackSend=new FeedBackSend();
feedBackSend.execute();
}
}
示例8: isValid
@Override
protected boolean isValid(TextView view) {
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
return emailPattern.matcher(view.getText()).matches();
}