final EditText tx = (EditText) findViewById(R.id.editText1);
final CheckBox cb = (CheckBox) findViewById(R.id.checkBox1);
cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
if(cb.isChecked()){
tx.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
}else{
tx.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
}
});