没有错误但在try catch语句之后没有执行任何操作

时间:2013-02-09 11:07:35

标签: android

我正在尝试使用网络服务显示数据。代码没有给出任何错误,但是在按钮单击时,执行仅发生在尝试零件上,除此之外什么都不执行

try {
                 Toast.makeText(getApplicationContext(), "You r in try", Toast.LENGTH_LONG).show();
                HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
                //this is the actual part that will call the webservice
                androidHttpTransport.call(SOAP_ACTION1, envelope);                
                // Get the SoapResult from the envelope body.
                SoapObject result = (SoapObject)envelope.bodyIn;
               //from here nothing executes but gives no error
                ****if(result != null**)
                {
                    Toast.makeText(getApplicationContext(), "You r in if", Toast.LENGTH_LONG).show();
                      //Get the first property and change the label text
                      tv1.setText(result.getProperty(0).toString());     
                }
                else
                {
                      Toast.makeText(getApplicationContext(), "No Response",Toast.LENGTH_LONG).show();
                }
          } catch (Exception e) {
                e.printStackTrace();
          }                         
        }
    });

1 个答案:

答案 0 :(得分:0)

您正在调用的几种方法抛出异常。

“跳过”代码表示抛出了异常。

在catch区块中举杯祝酒确认。