I am currently developing an app that will require that the user enters their password to access the game. I have the following if statement but it will not work, as you can see from the if statements I have tried three different ways to get the match to equal true.
    EditText passInput = (EditText) findViewById(R.id.passwordBox);
    CharSequence Password = passInput.getText();
    RelativeLayout loggedIn = (RelativeLayout) findViewById(R.id.LoggedInLayout);
    RelativeLayout CreateUser = (RelativeLayout) findViewById(R.id.createUserLayout);
    Button loginBtt = (Button) findViewById(R.id.createUser);
    String actualPass = password[x];
    System.out.println(Password + actualPass + passInput);
    if(Password.equals(actualPass)){
        System.out.println("They Matched!");
        loggedIn.setVisibility(View.VISIBLE);
        CreateUser.setVisibility(View.GONE);
        loginBtt.setText("Create User");
    }else if(Password.toString() == actualPass.toString()){
        System.out.println("Second Match");
    }else if(Password == actualPass){
        System.out.println("Third Match");
    }else if(Password.equals(actualPass) == false){
    System.out.println("Wrong");
    incorrectPassword();
    System.out.println(Password);
    System.out.println(actualPass);
    }
When the user registers they are required to set a password. For testing I tried the password 'trst' but when inserted to the login page it comes back as being not correct. This is what my LogCat displays:
11-07 11:46:16.357: I/System.out(1998): Wrong
11-07 11:46:16.547: I/System.out(1998): trst
11-07 11:46:16.547: I/System.out(1998): trst
As you can see from the LogCat the inserted password and the actual password are identical but the program says they are not!
 
     
     
     
    