我开发了一个登录表单。
这是我的网络服务代码:
public class Login {
    public String authentication(String userName,String password){
    String retrievedUserName = "";
    String retrievedPassword = "";
    String status = "";
    try{
        Class.forName("com.mysql.jdbc.Driver");
        Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/androidlogin","root","chathura");
        PreparedStatement statement =  con.prepareStatement("SELECT * FROM user WHERE username = '"+userName+"'");
        ResultSet result = statement.executeQuery();
        while(result.next()){
            retrievedUserName = result.getString("username");
            retrievedPassword = result.getString("password");
        }
        if(retrievedUserName.equals(userName)&&retrievedPassword.equals(password)){
            status = "Success!";
        }
        else{
            status = "Login fail!!!";
        }
    }
    catch(Exception e){
        e.printStackTrace();
    }
    return status;
    }
}
这是我的安卓代码:
try{
    androidHttpTransport.call(SOAP_ACTION, envelope);
    SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
    String status = response.toString();
    TextView result = (TextView) findViewById(R.id.tv_status);
    result.setText(response.toString());
    if(status.equals("Success!")){
        //   ADD  to save  and  read next time
        String strUserName = userName.getText().toString().trim();
        String strPassword = userPassword.getText().toString().trim();
        if (null == strUserName || strUserName.length() == 0){
            //  showToast("Enter Your Name");
            userName.setError( "username is required!" );
            isUserValidated = false;
        }
        if (null == strPassword || strPassword.length() == 0){
            //  showToast("Enter Your Password");
            isPasswordValidated = false;
            userPassword.setError( "password is required!" );
        } 
        if(isUserValidated && isPasswordValidated){
            Intent intent = new Intent(AndroidLoginExampleActivity.this,TabBarSimple.class);
            intent.putExtra("login",userName.getText().toString());
            startActivity(intent);           
        }
    }
    else{
        Intent i = new Intent(getApplicationContext(), AndroidLoginExampleActivity.class);
        startActivity(i);
    }
}
catch(Exception e){ 
    //
}
}
}
我目前的 o/p是:
- 如果我输入正确的登录详细信息,它会显示“成功”消息,然后进入下一个活动 
- 如果我输入错误的登录详细信息,它会显示“登录失败”消息。 
希望需要的o/p是:
- 如果我输入正确的登录详细信息,它应该直接进入下一个活动并且不应该显示任何成功消息。 
- 如果我输入了错误的登录详细信息,应该会显示“登录失败”消息。 
请帮我解决一下这个。我该如何开发这个?