DEV Community

Wajahat Karim 🇵🇰
Wajahat Karim 🇵🇰

Posted on • Originally published at android.jlelse.eu on

3

Show/Hide Password in EditText in Android

How to show/hide the password dots in the EditText in android in one line

This article is part of Today I Learned series and was originally posted at my TIL Github Repository and my website at wajahatkarim.com

With the Material design and latest Material Theming, android developers often use TextInputLayout and its great password toggle functionality. But, sometimes your applications have legacy designs like this:

In these cases, you will have to show/hide password with a CheckBox and its OnCheckedChangeListener . So, recently I had to do this and relying on the TextInputLayout ‘s automatic password toggle functionality, I forgot how to do this. So, here’s how its done which I have learned.

Dummy Layout

Now, you can toggle the password with EditText#setTransformationMethod() like the code below:

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)