I want to change/display different icons for show password in android edittext. I am using following code to display icon.
I implement it using text.. that is 'Show' and 'Hide'
textViewShowPassword.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (textViewShowPassword.getText().toString().equalsIgnoreCase("Show")) {
editTextPassword.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
textViewShowPassword.setText("Hide");
editTextPassword.setSelection(editTextPassword.getText().length());
} else {
textViewShowPassword.setText("Show");
editTextPassword.setTransformationMethod(new PasswordTransformationMethod());
editTextPassword.setSelection(editTextPassword.getText().length());
}
}
});
Hope this help for you..!!