andro prabu
andro prabu

Reputation: 364

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!.

Upvotes: 3

Views: 810

Answers (1)

Padma Kumar
Padma Kumar

Reputation: 20041

//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.

Upvotes: 4

Related Questions