Stuyvenstein
Stuyvenstein

Reputation: 2447

Android EditText accept 2 values only

I want an EditText to accept two characters only, a one(1) and a zero(0). I was reading about input filters and know how to accept numeric values only but what about specifying which characters to accept.

Can someone please give me an example as to how this is done?

Upvotes: 1

Views: 209

Answers (1)

kosa
kosa

Reputation: 66637

You may need to use something like TextWatcher, inside TextWathcer onTextChanged, if entered value is not either 1,0 display message.

Upvotes: 1

Related Questions