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 is not an answer,
Answer already given and accepted..
I just want to clarify about 129
password.setInputType(129);
is Actually,
password.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
'|' is not a pipe, it's a bitwise OR
. It takes two binary numbers and if either of the bits of equal value are 1,
How this relates to the input type: Each of the InputTypes are actually just ints.
TYPE_CLASS_TEXT is 1
, and TYPE_TEXT_VARIATION_PASSWORD is 128 (or 10000000)
.
Perform a bitwise OR
on them:
00000001
10000000
------------
10000001 which is 129.
Try entering input.setInputType(129);
instead, you'll see it'll work. :)