I have an EditText
field in my Android app named password
When I called password.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD)
, the field does not change into a password text field. Why is this and what can I do to make it a password field at runtime?
You need to combine 2 flags:
password.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
Check the other examples in the docs for InputType class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With