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.T开发者_如何学GoYPE_TEXT_VARIATION_PASSWORD);
alert.setView(input); //edit text added to alert
alert.setTitle("Password Required"); //title setted
input.setTransformationMethod(PasswordTransformationMethod.getInstance());
精彩评论