當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。