我有 asynctask 类,我在其中执行使用 web 服务并解析响应。解析后我得到列表<>。我怎样才能通过我的其他班级?
这是我的异步任务类
String response;
List<Item> lstresponse_locations = null;
// CustomAdapter CustAdapter;
// List<Item> lstresult = new ArrayList<Item>();
// ListView lstcities;
// String params;
@Override
protected String doInBackground(String... params) {
// TODO Auto-generated method stub\
SendRequesttoServer(params);
return response;
}
@Override
protected void onPostExecute(String result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
}
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
}
// getting response from webservice
public void SendRequesttoServer(String[] params) {
try {
SOAP_ACTION = NAMESPACE + METHOD;
SoapObject request = new SoapObject(NAMESPACE, METHOD);
request.addProperty("CityName", params[0]);
SoapSerializationEnvelope res = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
res.dotNet = true;
res.setOutputSoapObject(request);
HttpTransportSE call = new HttpTransportSE(url);
SoapPrimitive result;
call.call(SOAP_ACTION, res);
result = (SoapPrimitive) res.getResponse();
ParseLocations Objparselocations = new ParseLocations(
new ByteArrayInputStream(result.toString()
.getBytes("UTF-8")));
lstresponse_locations = Objparselocations.parse();
response = lstresponse_locations.toString();
// lstCities.toArray();
System.out.println(lstresponse);
} catch (SoapFault e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (XmlPullParserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
我怎样才能通过响应?谢谢 ramu