0
     conPass.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void afterTextChanged(Editable s) {
                System.out.println(s.toString());
                String password = pass.getText().toString();
                String confirmPass = conPass.getText().toString();
                if (!TextUtils.isEmpty(password) && !TextUtils.isEmpty(confirmPass)) {
                    if (password.equals(confirmPass)) {
                        Toast.makeText(MainActivity.this, "Password match", Toast.LENGTH_SHORT).show();
                    }

我应该使用什么代码才能在我停止输入 toast 消息时不会收到错误消息?

                else{
                        Toast.makeText(MainActivity.this, "Password did not match", Toast.LENGTH_SHORT).show();
                    }
                }
            }
        });
    }
}
4

0 回答 0