java - android ksoap2 crashes and I cannot catch it -


i following tutorial . straight-forward , crashes on emulator. cannot catch error. dont understand problem. here piece of code.

private final string namespace = "http://www.webservicex.net/"; private final string url = "http://www.webservicex.net/convertweight.asmx"; private final string soap_action = "http://www.webservicex.net/convertweight"; private final string method_name = "convertweight";  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      soapobject request = new soapobject(namespace, method_name);       string weight = "3700";     string fromunit = "grams";     string tounit = "kilograms";       propertyinfo weightprop =new propertyinfo();     weightprop.setname("weight");     weightprop.setvalue(weight);     weightprop.settype(double.class);     request.addproperty(weightprop);      propertyinfo fromprop =new propertyinfo();     fromprop.setname("fromunit");     fromprop.setvalue(fromunit);     fromprop.settype(string.class);     request.addproperty(fromprop);      propertyinfo toprop =new propertyinfo();     toprop.setname("tounit");     toprop.setvalue(tounit);     toprop.settype(string.class);     request.addproperty(toprop);      soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11);     envelope.dotnet = true;     envelope.setoutputsoapobject(request);     httptransportse androidhttptransport = new httptransportse(url);      try {         androidhttptransport.call(soap_action, envelope);         soapprimitive response = (soapprimitive)envelope.getresponse();         log.i("myapp", response.tostring());          textview tv = new textview(this);         tv.settext(weight+" "+fromunit+" equal "+response.tostring()+ " "+tounit);         setcontentview(tv);      } catch (exception e) {         e.printstacktrace();     }  } 

what think problem is? downloaded ksoap2 library , included in project. tried on real device , works. enabled internet access on config file.

any great. or can suggest tutorial?

after android 3.0 cannot access web in activity's main thread, need start new thread access web


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -