Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 有没有办法去掉烤面包;密码不匹配";如果我停止键入或删除键入的单词?_Java_Passwords_Password Confirmation - Fatal编程技术网

Java 有没有办法去掉烤面包;密码不匹配";如果我停止键入或删除键入的单词?

Java 有没有办法去掉烤面包;密码不匹配";如果我停止键入或删除键入的单词?,java,passwords,password-confirmation,Java,Passwords,Password Confirmation,我应该使用什么代码,以便在停止键入toast消息时不会出现错误 conPass.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override

我应该使用什么代码,以便在停止键入toast消息时不会出现错误

     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();
                    }

欢迎来到堆栈溢出。请阅读。我添加了标记并从代码块中提取了文本。请检查以确保我没有破坏任何内容,然后进一步澄清。您将登录名放在了错误的功能中。最好在从EditText中删除焦点时应用登录名,或者创建一个按钮并在其上应用登录名。
                else{
                        Toast.makeText(MainActivity.this, "Password did not match", Toast.LENGTH_SHORT).show();
                    }
                }
            }
        });
    }
}