Android String.equals doesn't work when I trying to match from httpresponse

Posted by user469652 on Stack Overflow See other posts from Stack Overflow or by user469652
Published on 2011-11-12T01:47:39Z Indexed on 2011/11/12 1:50 UTC
Read the original article Hit count: 179

Filed under:
        RestClient.post("auth/login/", loginparam, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(String s) {

                Toast.makeText(getApplicationContext(), String.valueOf(s.toLowerCase().equals("ok")), Toast.LENGTH_LONG).show();

                if (s.equals("ok")) {
                    startActivity(new Intent(getApplication(), HomeActivity.class));
                }


            }
        });

This is the code I used for login in android app, In the Toast text, I can see the server did returned "ok", but s.equals always failed in my case, can someone explain that? Thank you.

© Stack Overflow or respective owner

Related posts about android