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()) {
This might help you mate
checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// checkbox status is changed from uncheck to checked.
if (!isChecked) {
// show password
editText.setTransformationMethod(PasswordTransformationMethod.getInstance());
} else {
// hide password
editText.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
}
}
});