I need to create a login form with 'username' 'password' fields and two buttons 'login' and 'cancel' in my android application.
I am using an alert dialog with edittext inside that.
This is the code I used to create password edittext..
final EditText Password = new EditText(this); Password.setGravity(Gravity.CENTER); Password.setHint("Password"); Password.setWidth(200); Password.setTransformationMethod(new PasswordTransformationMethod()); login_alert.addView(Password);
My issue is that, plain text is shown instead of 'dots' when i open a softkeypad to edit the password. (It is shown as dots when not in softkeypad mode)
Can anyone suggest a solution?
app:passwordToggleDrawable - Drawable to use as the password input visibility toggle icon. app:passwordToggleTint - Icon to use for the password input visibility toggle. app:passwordToggleTintMode - Blending mode used to apply the background tint. More details in TextInputLayout documentation.
Just go into general, security, then scroll till you find 'make passwords visible' (show password characters briefly when you type them) this will stop the letters coming up for a short period of time and will reduce the chances of someone reading your password when you type it in.
Password.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
This one works for me.
But you have to look at Octavian Damiean's comment, he's right.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With