andorid中的get请求代码

   HttpGet httpGet = new HttpGet(SIGNIN_URL_HEADER + EMAIL + userName + AND + PASSWD
                    + encryptedPassword);
            HttpResponse httpResponse = new DefaultHttpClient().execute(httpGet);
            // if (httpResponse.getStatusLine().getStatusCode() == 200) {
            String result = EntityUtils.toString(httpResponse.getEntity());
            Log.e("", "userSignIn result = " + result);
            if (result.contains("AC01")) {
                Toast.makeText(mContext, R.string.sign_in_success, Toast.LENGTH_LONG).show();
                SharedPreferences preferences = getSharedPreferences("AccountInfo", 0);
                SharedPreferences.Editor editor = preferences.edit();
                editor.putString("userName", userName);
                editor.putString("password", password);
                editor.commit();
                return true;
            } else if (result.contains("AC02")) {
                Toast.makeText(mContext, R.string.wrong_passwd, Toast.LENGTH_LONG).show();
            }
 

你可能感兴趣的:(andorid)