Skip to content Skip to sidebar Skip to footer

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 could

Solution 1:

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.


Solution 2:

) You can also try the fork of Masked EditText. It's derived but with works with Gradle, has some bugfixes, an example project, and a little bit another behavior :-)

The behavior is also changed:

  1. You can set the flag and the hint will be always visible.
  2. Your pattern is invisible initially and grows automatically as soon, as you type. For instance, in the beginning, it is: "+7(", then you type '999' and it shows you "+7(999)" with another brace. In the original library, AFAIK it works like: "+7( ) - - ", then you type '999' and it transforms into "+7(999) - - " and so on.

Post a Comment for "Masking Input In EditText In Android"