private Button mBtnPassword; ide
private EditText mEtPassword; post
private boolean mbDisplayFlg = false; spa
/** Called when the activity is first created. */ orm
@Override get
public void onCreate(Bundle savedInstanceState) { it
super.onCreate(savedInstanceState); io
setContentView(R.layout.main); form
mEtPassword = (EditText)findViewById(R.id.password); date
mBtnPassword = (Button)findViewById(R.id.btnPassword); List
mBtnPassword.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Log.d("AndroidTest", "mbDisplayFlg = " + mbDisplayFlg);
if (!mbDisplayFlg) {
// display password text, for example "123456"
mEtPassword.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
} else {
// hide password, display "."
mEtPassword.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
mbDisplayFlg = !mbDisplayFlg;
mEtPassword.postInvalidate();
}
});
}