我正在处理事件列表的应用程序,应用程序从数据库获取事件,事件正确地到达应用程序抛出webservice,但我的问题是在listview的适配器中绑定soap对象,我这样做。
try {
aht.call(SOAP_ACTION, envelope);
resultsRequestSOAP = (SoapObject) envelope.getResponse();
// rs = (SoapPrimitive) envelope.getResponse();
// resultString = (List<UBAEvent>)envelope.getResponse();
} catch (Exception e) {
e.printStackTrace();
}
int x = resultsRequestSOAP.getPropertyCount();
adapter = new MyArrayAdapter(this);
UBAEvent ubaEvent = new UBAEvent();
for (int i = 0; i < x; i++) {
ubaEvent = (UBAEvent) resultsRequestSOAP.getProperty(i);
adapter.add(ubaEvent);
}但是没有人能帮我把soap对象绑定到适配器上吗?
发布于 2011-06-13 21:57:09
首先需要解析soapobjects中的答案ok,在本例中是resultsRequestSOAP。如果启用debug,则在变量aht中有XML响应。并且该xml已经在resultsRequestSOAP对象中进行了解析。要重新查看,请执行以下操作:
SoapObject s5 = (SoapObject)resultsRequestSOAP.getProperty(0);
String same=s5.getProperty("name").toString();在这些之后,您可以构建对象ubaEvent,您可以尝试复杂类型,所以我知道最好的方法是这些,或者您可以尝试使用序列化的硬方法
https://stackoverflow.com/questions/6331276
复制相似问题