当前位置: 首页>>代码示例>>Java>>正文


Java Patterns.EMAIL_ADDRESS属性代码示例

本文整理汇总了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;

	}
 
开发者ID:mityung,项目名称:XERUNG,代码行数:18,代码来源:VerifyOTP.java

示例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();
}
 
开发者ID:datalink747,项目名称:Rx_java2_soussidev,代码行数:15,代码来源:RxTextInputLayout.java

示例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 "";
}
 
开发者ID:afiqiqmal,项目名称:My-Android-Base-Code,代码行数:13,代码来源:DeviceUtils.java

示例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 "";
}
 
开发者ID:Webtrekk,项目名称:webtrekk-android-sdk,代码行数:12,代码来源:HelperFunctions.java

示例5: isEmailCorrect

private boolean isEmailCorrect(String email) {
	Pattern emailPattern = Patterns.EMAIL_ADDRESS;
	return emailPattern.matcher(email).matches();
}
 
开发者ID:treasure-lau,项目名称:Linphone4Android,代码行数:4,代码来源:CreateAccountFragment.java

示例6: isEmailCorrect

private boolean isEmailCorrect(String email) {
   	Pattern emailPattern = Patterns.EMAIL_ADDRESS;
   	return emailPattern.matcher(email).matches();
}
 
开发者ID:treasure-lau,项目名称:Linphone4Android,代码行数:4,代码来源:InAppPurchaseHelper.java

示例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();
    }

}
 
开发者ID:akashdeepsingh9988,项目名称:Cybernet-VPN,代码行数:66,代码来源:FeedBackActivityFragment.java

示例8: isValid

@Override
protected boolean isValid(TextView view) {
    Pattern emailPattern = Patterns.EMAIL_ADDRESS;
    return emailPattern.matcher(view.getText()).matches();
}
 
开发者ID:Ilhasoft,项目名称:data-binding-validator,代码行数:5,代码来源:EmailTypeRule.java


注:本文中的android.util.Patterns.EMAIL_ADDRESS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。