Android 为什么条件在AsyncTask onPostExecute中不起作用

Android 为什么条件在AsyncTask onPostExecute中不起作用,android,web-services,android-asynctask,Android,Web Services,Android Asynctask,我在AsyncTask中的doinbackground()中获得了成功响应。当我在postExecute()上检查equalsignorecase时,它没有进入内部。下面是我的代码。我如何进入下一步,有什么问题请帮助我 class Service extends AsyncTask<String, String, String> { String responseStr = null; String res="Failure";

我在AsyncTask中的doinbackground()中获得了成功响应。当我在postExecute()上检查equalsignorecase时,它没有进入内部。下面是我的代码。我如何进入下一步,有什么问题请帮助我

   class Service extends AsyncTask<String, String, String>
    {
        String responseStr = null;
        String res="Failure";
        ProgressDialog pd;
        @Override
        protected void onPreExecute() {
            // TODO Auto-generated method stub
            super.onPreExecute();
            pd = new ProgressDialog(MainActivity.this);
            pd.setMessage("Loading..");
            pd.show();
        }
        @Override
        protected String doInBackground(String... args) {
          try {

            HttpClient httpclient = new DefaultHttpClient();
                HttpPost httppost = new HttpPost(Config.POST_URL);
                List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
                nameValuePairs.add(new BasicNameValuePair("loantype",mortageText));
                if(mortageText.equalsIgnoreCase("Refinanace"))
                nameValuePairs.add(new BasicNameValuePair("loanamount",h_borrow));
                nameValuePairs.add(new BasicNameValuePair("esthomevalue",estimatedHM));
                nameValuePairs.add(new BasicNameValuePair("creditscore",thirdViewBoxText));
                if(mortageText.equalsIgnoreCase("Refinanace"))
                nameValuePairs.add(new BasicNameValuePair("currentinterstrate",Integer.toString(intrest)));
                nameValuePairs.add(new BasicNameValuePair("fname",firstNameText));
                nameValuePairs.add(new BasicNameValuePair("lname",lastNameText));
                nameValuePairs.add(new BasicNameValuePair("address",streetAddressText));
                nameValuePairs.add(new BasicNameValuePair("email",emailText));
                nameValuePairs.add(new BasicNameValuePair("city",cityText));
                nameValuePairs.add(new BasicNameValuePair("state",stateText));
                nameValuePairs.add(new BasicNameValuePair("zip",zipText));
                nameValuePairs.add(new BasicNameValuePair("phone",phoneText));
                nameValuePairs.add(new BasicNameValuePair("currentyinfha",militaryText));
                nameValuePairs.add(new BasicNameValuePair("miltaryservice",militaryserviceText));

                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));                  
                try {
                    HttpResponse response = httpclient.execute(httppost);
                    responseStr = EntityUtils.toString(response.getEntity());

                } catch (ClientProtocolException e) {
                    e.printStackTrace();
                    return null;
                }

             }catch (Exception e) {
                e.printStackTrace();
            }

            return responseStr;
        }
        protected void onPostExecute(String result) {
            super.onPostExecute(result);
            pd.cancel();
            if(result.equalsIgnoreCase("Success"))
            {
                dialogGreatNews();

            }

        }
    }
类服务扩展异步任务
{
字符串responsest=null;
String res=“失败”;
进展性帕金森病;
@凌驾
受保护的void onPreExecute(){
//TODO自动生成的方法存根
super.onPreExecute();
pd=新建进度对话框(MainActivity.this);
pd.setMessage(“加载…”);
pd.show();
}
@凌驾
受保护的字符串doInBackground(字符串…args){
试一试{
HttpClient HttpClient=新的DefaultHttpClient();
HttpPost-HttpPost=newhttppost(Config.POST\uURL);
List nameValuePairs=新的ArrayList(1);
添加(新的BasicNameValuePair(“loantype”,mortageText));
if(mortageText.equalsIgnoreCase(“refinance”))
添加(新的BasicNameValuePair(“loanamount”,h_borrow));
添加(新的BasicNameValuePair(“esthomevalue”,estimatedHM));
添加(新的BasicNameValuePair(“creditscore”,thirdViewBoxText));
if(mortageText.equalsIgnoreCase(“refinance”))
添加(新的BasicNameValuePair(“currentinterstrate”,Integer.toString(intrest)));
添加(新的BasicNameValuePair(“fname”,firstNameText));
添加(新的BasicNameValuePair(“lname”,lastNameText));
添加(新的BasicNameValuePair(“地址”,streetAddressText));
添加(新的BasicNameValuePair(“电子邮件”,emailText));
添加(新的BasicNameValuePair(“城市”,cityText));
添加(新的BasicNameValuePair(“state”,stateText));
添加(新的BasicNameValuePair(“zip”,zipText));
添加(新的BasicNameValuePair(“电话”,phoneText));
添加(新的BasicNameValuePair(“CurrentYNFHA”,军事文本));
添加(新的BasicNameValuePair(“miltaryservice”,militaryserviceText));
setEntity(新的UrlEncodedFormEntity(nameValuePairs,“UTF-8”);
试一试{
HttpResponse response=httpclient.execute(httppost);
responsest=EntityUtils.toString(response.getEntity());
}捕获(客户端协议例外e){
e、 printStackTrace();
返回null;
}
}捕获(例外e){
e、 printStackTrace();
}
返回响应;
}
受保护的void onPostExecute(字符串结果){
super.onPostExecute(结果);
pd.cancel();
if(result.equalsIgnoreCase(“Success”))
{
dialogGreatNews();
}
}
}

修剪空白或检查是否存在新行字符

if(result.trim().equalsIgnoreCase("Success")) {

    dialogGreatNews();

}

onPostExecute()
结果达到
onPostExecute()
时,您是否使用
Log.d()
测试了它的实际内容?没有,我在doInBackGround()中使用Log.v()测试了它,但它是否返回了预期值?空白问题。谢谢你的回复。