我终于得到了肥皂响应中的数据,我想将这些数据解析为listview,请帮帮我
我的代码是
SoapObject result=(SoapObject)envelope.bodyIn;
SoapObject element1=(SoapObject) result.getProperty("CategoriasBO_ObtenerTodosResult");
System.out.println("--------------element "+element1.toString());
SoapObject element2=(SoapObject) element1.getProperty("diffgram");
SoapObject docmntElmnt = (SoapObject) element2.getProperty("DocumentElement");
System.out.println(docmntElmnt.getPropertyCount());
for(int i=0;i<docmntElmnt.getPropertyCount();i++)
{
SoapObject table = (SoapObject)docmntElmnt.getProperty(i);
System.out.println("-----Table data is---"+table.toString());
}
我的肥皂反应是
-----Table datais---anyType{CategoriaID=8; Nombre=Bar & Restaurants;
Imagen1=/desktopmodules/guatsup/categorias/images/home/home8.png;
Imagen2=desktopmodules/guatsup/categorias/images/Categoria/bar-restaurants1.png;
Activa=true; }
07-12 09:17:31.164: INFO/System.out(205): -----Table data
is---anyType{CategoriaID=9; Nombre=Fashion & Beauty;
Imagen1=/desktopmodules/guatsup/categorias/images/home/home7.png;
Imagen2=desktopmodules/guatsup/categorias/images/Categoria/fashion-beauty2.png;
Activa=true; }
07-12 09:17:31.164: INFO/System.out(205): -----Table data
is---anyType{CategoriaID=10; Nombre=Party & Entertainment;
Imagen1=/desktopmodules/guatsup/categorias/images/home/home2.png;
Imagen2=desktopmodules/guatsup/categorias/images/Categoria/party-entertainment2.png;
Activa=true; }
07-12 09:17:31.164: INFO/System.out(205): -----Table data
is---anyType{CategoriaID=11; Nombre=Life & Style;
Imagen1=/desktopmodules/guatsup/categorias/images/home/home3.png;
Imagen2=desktopmodules/guatsup/categorias/images/Categoria/life-style1.png;
Activa=true; }
答案 0 :(得分:0)
你需要做的是从肥皂反应中获取所需的元素字符串,如下所示:
SoapObject result = (SoapObject) envelop.getResponse();
String element1 = result.getProperty("element name").toString();
这会将元素存储到String对象中。
然后实现ListView,为此你将使用ArrayList将对象添加到列表中。
然后将Class String的element1对象添加到listList的listList中,你就完成了。
希望这有帮助。
有关详细信息,请咨询我。