2

I am facing issues with update of android Version.

setPasswordVisibilityToggleEnabled(boolean)' is deprecated

I want my login view to switch between hide and show password toggle icon in TextInputLayout.

But, how do I use instead of using setPasswordVisibilityToggleEnabled(boolean)?

I also searched this on Google and I found they recommend me to use setEndIconDrawable(int) instead.

But I don't know how to use it?

I also found this How to switch between hide and view password But I don't wanna use this code.

Is there any other way to develop like this? Thank you all!.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Ya Min Oo
  • 55
  • 7

2 Answers2

4

You should instead use:

textInputLayout.setEndIconMode(TextInputLayout.END_ICON_PASSWORD_TOGGLE)

Docs for setEndIconMode

Docs for END_ICON_PASSWORD_TOGGLE

Ryan M
  • 18,333
  • 31
  • 67
  • 74
0

https://developer.android.com/reference/com/google/android/material/textfield/TextInputLayout#getEndIconMode() Here you can see the information about the new method for hiding / showing text

Destroyer
  • 785
  • 8
  • 20