Reputation: 6188
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?
Upvotes: 6
Views: 2673
Reputation: 8598
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.
Upvotes: 12