本文整理匯總了Java中android.util.Patterns.PHONE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Patterns.PHONE屬性的具體用法?Java Patterns.PHONE怎麽用?Java Patterns.PHONE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.util.Patterns
的用法示例。
在下文中一共展示了Patterns.PHONE屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: validatePhone
/**
* @author Soussi
*
* @param phone
* Function Checks for validity Phone and return true or false
*/
private static boolean validatePhone(String phone) {
Pattern patternEmail = Patterns.PHONE;
if (TextUtils.isEmpty(phone))
return false;
matcher = patternEmail.matcher(phone);
return matcher.matches();
}
示例2: VerifyPhoneCompac
public VerifyPhoneCompac() {
super(DEFAULT_MESSAGE, Patterns.PHONE);
}
示例3: VerifyPhone
public VerifyPhone() {
super(DEFAULT_MESSAGE, Patterns.PHONE);
}
示例4: 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();
}
}