2012-07-13 39 views
-1

我正在尝试处理来自API的XML plist数据,但是碰到很多墙壁!如何从ArrayList中的对象中获取项目值

数据是苹果plist格式,我使用Akos的代码this link解析,这似乎很好地工作。它解析为String,Object到HashMap中。我能够得到给定键的值,即。

Object childItems = items.mPlistHashMap.get("childItems"); 
System.out.println(childItems.getClass()); 
System.out.println(childItems); 

childItems.getClass()示出了如 - 类java.util.ArrayList

的logcat的输出为childItems示出 - [{remoteFilePath =/Picture.png,主机= www.host .com,ratingCount = 1,targetId = 82,commentCount = 1,externalId =/demo.host.com/Private/Picture.png,fileSize = 23738,entity_name = Item,memberAccessLevel = 0,leaderAccessLevel = 0,name =图片。 png,target = SystemUser,ownerAccessLevel = 3,tagCount = 1},{lastName = Test,entity_name = User,username = Test,host = www.host.com,userId = 82,firstName = Test,password = TestPwd,loginName =测试},{typeId = 0,entity_na我= UserType,名称= UserType_Teacher}]

我认为我可以然后使用此ArrayList,但这是我未来的地方。例如,我想获取remoteFilePath值,并将其显示在ListView中(已经为本地文件工作)。

上面的示例childItems列表只包含一个文件(Picture.png),但该列表可能包含任意数量的文件,因此我需要迭代列表并获取remoteFilePath的任何值以显示。

任何帮助表示赞赏,我只是不知道如何“沮丧”到这个列表中,或者如果childItems对象需要被转换为一个新的Array等等。

如果我错过任何重要信息,问我应提供:)

回答

0
ArrayList<?> childItems = (ArrayList<?>) elockeritems.mPlistHashMap.get("childItems"); 

我现在可以用这方面的工作。我需要把我的头脑放在基本面上!