SIVAKUMAR.J
SIVAKUMAR.J

Reputation: 4354

how to block the special character and smaller case characters in android EditText?

I'm developing an android application. I'm using android 2.3.3 for development.

Here in one screen I'm showing text box (EditText) and get the input from user.
The requirement is the restrict the user to type only capital letters (only alphabets,numbers) and no special character allowed

For that if I use "InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS" then it will allow only capital characters (only displays keyboard as capital letters) but it also allows special characters &, * etc.

But i need ,that no special characters and the keyboard shows only the upper case letters
Whether the above is possible in android or not?
All your ideas are welcome.

Upvotes: 0

Views: 4239

Answers (1)

venkateswaran
venkateswaran

Reputation: 233

android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
android:inputType="textCapCharacters"
android:capitalize="sentences"

use the above line in the.xml file so that it only enters the alphabets and numbers only

Upvotes: 13

Related Questions