Search code examples
androidmasking

Masking Input in EditText in Android


How to use inputfilter for CNIC i.e #####-#######-# ? Please help me.. I am new to Android and I dont know how to use it?

How to mask input? I went through various sites but couldn't find solution. I am so confused.


Solution

  • Have you tried using Masked EditText ? This is what you want ... :)

    If you want a numeric keyboard instead of alphabetical, then comment the following lineof code:

    this.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    

    in the file MaskedEditText.java. Now setting android:inputType = "numeric" will work.