Mask / unmask password field programmatically?

I am currently working on an Android project, I want to allow the user to hide or show their password on the screen by checking the box.

How would I go about replacing each character in a string with *, or is there a concrete way to do this.

For example, if the password is my_password , I want it replaced with *********** .

Thanks for any help you can provide.

+4
source share
1 answer

You can use setTransformationMethod in a TextView along with PasswordTransformationMethod to display stars.

+7
source

Source: https://habr.com/ru/post/1432586/


All Articles