Android 解析kSoap对对象数组的响应

Android 解析kSoap对对象数组的响应,android,arraylist,Android,Arraylist,我的问题是:我有一个SoapObject。我已经成功地遍历了它,找到了不同的嵌套元素,并将它们保存在objectI think 我的代码是: if(sResult != null) { SoapObject soapresults = (SoapObject)sResult.getProperty(0); int count = soapresults.getPropertyCount();

我的问题是:我有一个SoapObject。我已经成功地遍历了它,找到了不同的嵌套元素,并将它们保存在objectI think

我的代码是:

        if(sResult != null)
        {
            SoapObject soapresults = (SoapObject)sResult.getProperty(0);

            int count = soapresults.getPropertyCount();

            ChildStatus[] children = new ChildStatus[count];

            for (int i = 0; i < count; i++)
            {
                SoapObject kid = (SoapObject)soapresults.getProperty(i);
                ChildStatus childStatus = new ChildStatus();
                SoapObject value = (SoapObject)kid.getProperty("Value");
                SoapObject info = (SoapObject)value.getProperty("Info");

                childStatus.CheckOutPlanned = value.getPropertyAsString("CheckOutPlannedTime");
                childStatus.CurrentStatus = value.getPropertyAsString("CurrentStatus");
                childStatus.FullName = info.getPropertyAsString("FullName");
                childStatus.ID = info.getPropertyAsString("Id");
                childStatus.KindergardenID = info.getPropertyAsString("KindergardenId");
                childStatus.URL = info.getPropertyAsString("ThumbnailUrl");

                String pickUpBy = value.getPropertyAsString("PickUpBy");


                if(pickUpBy.equalsIgnoreCase("anyType{}"))
                {
                    System.out.println("Ja");
                    pickUpBy = "none";
                } else if(pickUpBy.equalsIgnoreCase("En anden forælder"))
                {
                    childStatus.PickUpWithKidID = value.getPropertyAsString("PickUpWithKidId");
                    childStatus.PickUpWithKidName = value.getPropertyAsString("PickUpWithKidName");
                }

                childStatus.PickUpBy = value.getPropertyAsString("PickUpBy");

                children[i] = childStatus;
            }

            System.out.println("Size: " + children.length);
现在我该如何使用类中的对象数组

我在某处看到,我需要这样做:

ArrayList<MyClass> myList = new ArrayList<MyClass>();

myList.add( new MyClass() );

myList.get( 0 ).myMethodFromMyClass();
从一个对象数组中获取一个对象,但我对Android还是相当陌生


我真的很感激你能给我的任何帮助

我很难理解你到底想做什么

// Get rid of the table
REMOVE ChildStatus[] children = new ChildStatus[count]; 

// Create the ArrayList
ArrayList<ChildStatus> myChild = new ArrayList<ChildStatus>();  

for (int i = 0; i < count; i++) 
{   
    ChildStatus childStatus = new ChildStatus(); 

    ...
    HERE YOU POPULATE YOUR childStatus OBJECT WITH THE SOAPOBJECT
    ...

    // Add objects built from SOAPObject to the ArrayList
    myChild.add(childStatus);

    // The table is of no matter here 
    REMOVE children[i] = childStatus; 
} 

// Use inner methods from an element of the ArrayList (here the number of properties for the first element)
myChild.get(0).getPropertyCount()

我可能被你问的问题误导了,如果这不是你想要的,很抱歉。

啊,是的,我在当天晚些时候找到了解决办法,这与你在这里建议的方法类似……:不过还是谢谢你…请。请参考链接,了解如何将数组数据传递到android中的SOAP服务吗?
ArrayList<ChildStatus> myChild = new ArrayList<ChildStatus>();
myChild.add( new ChildStatus() );
myChild.get(0).??
Status *theStatus = [statusConnection.statusArray objectAtIndex:i];
// Get rid of the table
REMOVE ChildStatus[] children = new ChildStatus[count]; 

// Create the ArrayList
ArrayList<ChildStatus> myChild = new ArrayList<ChildStatus>();  

for (int i = 0; i < count; i++) 
{   
    ChildStatus childStatus = new ChildStatus(); 

    ...
    HERE YOU POPULATE YOUR childStatus OBJECT WITH THE SOAPOBJECT
    ...

    // Add objects built from SOAPObject to the ArrayList
    myChild.add(childStatus);

    // The table is of no matter here 
    REMOVE children[i] = childStatus; 
} 

// Use inner methods from an element of the ArrayList (here the number of properties for the first element)
myChild.get(0).getPropertyCount()