Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Validations in android/eclipse

How to restrict an edittextbox with numbers and special symbols on android/eclipse.

ie., i must want to allow only the characters (a-z & A-Z) not the others.

Is there any options available to do this through .xml(file)?

Thanks in advance!.

like image 886
andro prabu Avatar asked Mar 10 '26 01:03

andro prabu


1 Answers

//ya its avilable

in your string.xml you can add and resource as

<string name="specific_chars">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz _1234567890</string>

and access in your edit text add attribute as

android:digits="@string/specific_chars"

now only the specified characters only edittext will take.

like image 182
Padma Kumar Avatar answered Mar 12 '26 14:03

Padma Kumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!