Check out example codes for "mobile number validation to edittext in android". It will help you in understanding the concepts better.

Code Example 1

public boolean isValidPhone(CharSequence phone) {
if (TextUtils.isEmpty(phone)) {
return false;
} else {
return android.util.Patterns.PHONE.matcher(phone).matches();
}
}

Learn ReactJs, React Native from akashmittal.com