Sorry, my fault When I defined the object in my view, I defined it as
EditText passwordEditText = findViewById(R.id.txt_password);
This causes confusion, and when I defined it as
passwordEditText = findViewById(R.id.txt_password);
it was fixed. However, it may still shed light on programmers who make such stupid mistakes. :)