1

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
  • 250,295
  • 77
  • 670
  • 690
Ya Min Oo
  • 35
  • 5

2 Answers2

3

You should instead use:

textInputLayout.setEndIconMode(TextInputLayout.END_ICON_PASSWORD_TOGGLE)

Docs for setEndIconMode

Docs for END_ICON_PASSWORD_TOGGLE

Ryan M
  • 15,686
  • 29
  • 53
  • 64
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
  • 756
  • 6
  • 19