Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Password field in AlertDialog

I have created a alert dialog with edit text. How to set the property of the edittext as password?

Here is the code...

final AlertDialog.Builder alert = new AlertDialog.Builder(this);
final EditText input = new EditText(this);

input.setInputType(InputType.TYPE_CLASS_TEXT| InputType.TYPE_TEXT_VARIATION_PASSWORD);

alert.setView(input);    //edit text added to alert
alert.setTitle("Password Required");   //title setted
like image 494
Parthi04 Avatar asked Oct 20 '25 10:10

Parthi04


1 Answers

input.setTransformationMethod(PasswordTransformationMethod.getInstance());
like image 76
Vinoth Avatar answered Oct 22 '25 23:10

Vinoth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!