Masked Input Using EditText Widget in Android

Posted by Buzzy on Stack Overflow See other posts from Stack Overflow or by Buzzy
Published on 2010-05-26T11:19:32Z Indexed on 2010/05/26 11:21 UTC
Read the original article Hit count: 292

Filed under:
|
|

Is there a way I can specify an input mask to the EditText control in Android?

I want be able to specify something like ### - ## - #### for a Social Security Number. This will cause any invalid input to be rejected automatically (example, I type alphabetical characters instead of numeric digits).

I realize that I can add an OnKeyListener and manually check for validity. But this is tedious and I will have to handle various edge cases.

Buzzy

© Stack Overflow or respective owner

Related posts about android

Related posts about mask