密码和确认密码必须相同
我有两个编辑文本字段,例如密码和确认密码,如果两个条目均为 true,则应将密码字符串值传递到服务器,但我在 log-cat 中没有从服务器获得正确的响应,我收到否定响应
是什么这段代码有错吗?帮我解决这个问题。
EditText etxt_password = (EditText) findViewById(R.id.regetpwd);
EditText etxt_confirmpassword = (EditText) findViewById(R.id.regetrepwd)
password = etxt_password.getText().toString();
confirmpassword = etxt_confirmpassword.getText().toString();
if (confirmpassword != null && password != null)
{
if (password.equals(confirmpassword))
{
request.addProperty("password", password);
}
}
其中 request 是 SOAP 对象,我通过它将值传递给服务器
I have two edit text fields like password and confirm-password if both the entries are true then password string value should be passed to server, but i m not getting the correct response from the server in log-cat, I am getting negative response
what is the wrong with this code? help me to solve this.
EditText etxt_password = (EditText) findViewById(R.id.regetpwd);
EditText etxt_confirmpassword = (EditText) findViewById(R.id.regetrepwd)
password = etxt_password.getText().toString();
confirmpassword = etxt_confirmpassword.getText().toString();
if (confirmpassword != null && password != null)
{
if (password.equals(confirmpassword))
{
request.addProperty("password", password);
}
}
where request is the SOAP object through which I m passing the value to server
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对我来说看起来不错,但我已经连续 40 个小时没睡了……所以这并不算什么。我唯一可以建议的是尝试组合两个 if 语句(您只需要知道一个不为空并且两者等于即可获得有效密码)。另一件要尝试的事情可能是检查长度 > 0 而不是检查 null?我不记得当您对其执行
getText().toString()
时,空的 EditText 是否返回 null 或空字符串...It looks fine to me, but I've been awake for 40 hours straight... so thats not really much to go on. the only thing I can suggest is trying to combine the two if statements (you only need to know one is not null and that the two are equal to get a valid password). the other thing to try would be to maybe check the length > 0 rather than check null? I can't recall if an empty EditText returns null or empty string when you do a
getText().toString()
on it...