i string of array on responsejson this
result: responsejson = ["product1","product2","product1","product2"] try { // invole web service androidhttptransport.call(soap_action+methname, envelope); // response soapprimitive response = (soapprimitive) envelope.getresponse(); // assign static variable responsejson = response.tostring(); } catch (exception e) { e.printstacktrace(); } how can each element of array can use display on listview?
thanks
public void invokejsonws(string country, string methname) { // create request soapobject request = new soapobject(namespace, methname); /* // property holds input parameters propertyinfo parampi = new propertyinfo(); // set name parampi.setname("country"); // set value parampi.setvalue(country); // set datatype parampi.settype(string.class); // add property request object request.addproperty(parampi); */ // create envelope soapserializationenvelope envelope = new soapserializationenvelope( soapenvelope.ver11); envelope.dotnet = true; // set output soap object envelope.setoutputsoapobject(request); // create http call object httptransportse androidhttptransport = new httptransportse(url); try { // invole web service androidhttptransport.call(soap_action+methname, envelope); // response soapprimitive response = (soapprimitive) envelope.getresponse(); // assign static variable responsejson = response.tostring(); jsonarray responsearr = new jsonarray(responsejson); for(int i=0;i < responsearr.length();i++) { string temp=responsearr.getstring(i); myproduct.add(new product(responsejson,2,r.drawable.user_awake,responsejson)); } } catch (exception e) { e.printstacktrace(); } } this method used it correct include adding item in list view??
please help
thanks
pass string jsonaarry constructor
arraylist<string> mparsedlist = new arraylist<string>(); jsonaarry responsearr=new jsonarray(responsejson); for(int i=0;i<responsearr.length;i++) { string temp=responsearr.getstring(i);// 1 one element myproduct.add(new product(temp,2,r.drawable.user_awake,responsejson)); }
Comments
Post a Comment