I am an android Beginner,
I want to validate phone numbers with special character + , ( , ) , - and all digits
example (123)456-7894
I tried this code
public boolean validCellPhone(String number){
boolean b=true;
String MOBILE_PATTERN = "[(,),-][0-9]{10,16}"; // ddm validating
pattern = Pattern.compile(MOBILE_PATTERN);
matcher = pattern.matcher(cellph.getText().toString());
if (!matcher.matches()) {
cellph.requestFocus();
b=false;
}
else{
b=true;
}
return b;
}