Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling EditText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD) does not change text field to a password field

Tags:

android

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?

like image 458
Sandah Aung Avatar asked Jan 24 '14 07:01

Sandah Aung


1 Answers

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.

like image 95
Melquiades Avatar answered Nov 16 '22 22:11

Melquiades