Search code examples
androidandroid-edittextdigits

Allow limited keyboard digits in edit text, android?


I want to allow only alphabets, numbers and some of the special characters in Edit text:

android:digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ()*-_,;':."

I also want to allow am-percent(&) and double quote (") When I add am-percent in digits i get this error

The entity name must immediately follow the '&' in the entity reference.

How do I add both of these special characters??


Solution

  • Try using & and "

    You can find a full list here: List of XML and HTML character entity references