I use an EditText to enter password. And a CheckBox to show password or not. Below function is the part:
public void ShowPassword() {
if (cb.isChecked()) {
I think you are using the wrong function. I make that way and work perfectly:
passwordEditView = (EditText) rootView.findViewById(R.id.password);
final CheckBox showPasswordCheckBox = (CheckBox) rootView.findViewById(R.id.checkbox);
showPasswordCheckBox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (showPasswordCheckBox.isChecked()){
passwordEditView.setTransformationMethod(null);
}else{
passwordEditView.setTransformationMethod(new PasswordTransformationMethod());
}
}
});