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