void
void

Reputation: 479

Allow values in edittext(Android)

In my Android project I want to put certain condition on edittext that it can accepts only following list of values :-

!#$%&'()*+,-./:;<>=?@[]\_`{}|~^"*abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

and not the the values like shown in keyboard such as ©,® :- enter image description here

Kindly provide me solution.

Upvotes: 0

Views: 79

Answers (1)

tony9099
tony9099

Reputation: 4717

use this in the XML file.

<EditText 
  android:inputType="text" 
  android:digits="!#$%&'()*+,-./:;<>=?@[]\_`{}|~^"*abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" 
  android:hint="Only letters, digits, _ and - allowed"
/>

Upvotes: 1

Related Questions