开发者

How to bind data to list view from soap reponse in android

开发者 https://www.devze.com 2023-03-19 08:00 出处:网络
I finally got data from soap response like this i want to parse this data to listview please help me My Code is

I finally got data from soap response like this i want to parse this data to listview please help me

My Code is

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());

       }

My soap response is

-----Table datais---anyType{CategoriaID=8; Nombre=Bar & Restaurants;
Imagen1=/desktopmodules/guatsup/categorias/images/home/home8.png;
Imagen2=desktopmodules/guatsup/categorias/images/Categ开发者_开发技巧oria/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; }


What u need to do is Get the required elements String form the Soap Response like following:

  SoapObject result = (SoapObject) envelop.getResponse();
  String element1 = result.getProperty("element name").toString();

This will store the element into your String Object.

Then Implement the ListView and for that u will be using ArrayList to add object into the list.

Then add the element1 object of Class String into the ArrayList for listview and u will be done.

Hope this helps.

For more information you can Ask Me.

0

精彩评论

暂无评论...
验证码 换一张
取 消