if ((user_name == txt_name.getText()) && (user_password == txt_password.getText()))
改为:
if ((user_name.equals(txt_name.getText())) && (user_password.equals(txt_password.getText())))所有的字符串比较用equals来进行。

解决方案 »

  1.   

    是条件判断的问题,用txt_name.getText().equals(user_name)作为判断条件,下面所有的==都如此。
      

  2.   

    同意................
    如果是String一定要用equals
    不是尽量转变成String来比较
    当比较两个引用是否相同时用==
    比如String s1 = "OK";
    String s2="0k";
    s1.equals(s2)   返回true
    s1==s2    返回false
    如果是String s1 = "OK";String s2 = s1;
    s1.equals(s2)   返回true
    s1==s2    也返回trueString s1 = "OK";