Validate Mobile number with the country code
问题 I want to validate the mobile number user enters. I have two edit texts one for the code i.e. +91,0 etc and another for the phone number. I have a question that how to stop entering the numbers in edit text if more than 10 numbers being entered by the user. Also it should get validated with code and the number. I tried the validation with this code. private boolean isValidMobile(String phone) { return android.util.Patterns.PHONE.matcher(phone).matches(); } else if (!isValidMobile(code.getText