没有,在android中检查密码和重复密码之间的工作

时间:2016-02-29 07:08:07

标签: android

........................................
 else if (e8.getText().toString().length() == 0) {
                    e8.setError("Password is required");
                    Toast.makeText(getApplicationContext(), "Please enter Password", Toast.LENGTH_SHORT).show();
                    i = 0;

                }

                else if (e9.getText().toString().length() == 0) {
                    e9.setError("Password is required");
                    Toast.makeText(getApplicationContext(), "Please enter Password", Toast.LENGTH_SHORT).show();
                    j = 0;
                }

                else if (!e8.equals(e9.getText()))
                {
                    e9.setError("Both Passwordsxmvbxb are different");
                    Toast.makeText(getApplicationContext(), "Please enter Correct Password", Toast.LENGTH_SHORT).show();
                    k = 0;
                }
........................................

4 个答案:

答案 0 :(得分:1)

试一下

function functionA() {
    console.log( arguments );
}
function functionB( fn ) {
    fn({"d": "c"}); //passing the extra arguments from here
}
functionB( function() {  
    var obj ={
        a : 'foo',
        b : 'bar'
    }; 
    obj.extra = arguments; //adding the arguments to function A
    functionA( obj );
});

答案 1 :(得分:1)

尝试这种方法。

if(validate()){
    // perform operation
}

方法声明:

private boolean validate() 
  {
    if (TextUtils.isEmpty(edtPassword.getText())) {

        //toast enter password

        return false;

    } else if (TextUtils.isEmpty(edtConfirmPassword.getText())) {

        //toast enter confirm password

        return false;
    } else if (!edtPassword.getText().toString().equals(edtConfirmPassword.getText().toString())) {
        //toast password not match

        return false;
    }
    return true; // considering all conditions are true
}

答案 2 :(得分:0)

当你检查任何两个字符串时,它应该是String。你当前正在做e8.equal,其中e8是你的EditText所以它将检查是否有相同的对象。它应该是

if(!e8.getText().toString().equals(e9.getText().toString()))

答案 3 :(得分:0)

使用.equals代替 == 来比较字符串。