3

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

andro prabu
  • 364
  • 3
  • 13
  • possible duplicate of [How to restrict special characters from an Android EditText field?](http://stackoverflow.com/questions/3385631/how-to-restrict-special-characters-from-an-android-edittext-field) and http://stackoverflow.com/questions/2361497/how-to-create-edittext-accepts-alphabets-only-in-android – Harry Joy Jun 07 '12 at 09:17

1 Answers1

4

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

Padma Kumar
  • 19,893
  • 17
  • 73
  • 130