4

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
Parthi04
  • 1,121
  • 4
  • 21
  • 39

1 Answers1

8
input.setTransformationMethod(PasswordTransformationMethod.getInstance());
Derlin
  • 9,572
  • 2
  • 32
  • 53
Vinoth
  • 5,687
  • 11
  • 44
  • 56