I have an EditText field in my project which stands for the full name of the person.So I want only letters and spaces to be allowed in it.So I tried the following in the
Add this line in your EditText tag.
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
Your EditText tag should look like:
it works perfectly and no validation condition required
regex
src.toString().matches("[a-zA-Z ]+")
Fair enough if that's the case then simply add space in between.
android:digits="abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ"