webmethod 配列から取得してリストビューに表示する方法を知っている人はいますか? これは私のWebメソッドです:
[WebMethod]
public info[] retrieveInfo (String code){
SQLCon..
.
.
info [] a = new info [count];
cmd..
.
.
while(reader.Read()){
a[i].id = (int)reader["ID"];
a[i].description = (string)reader["Description"];
a[i].date = (string)reader["Date"];
a[i].url = (string)reader["URL"];
a[i].name = (string)reader["Name"];
i++
}
reader.Close();
conn.Close();
Array.Reverse(a);
return a;
ここまでしか分かりませんでした。その後、私は完全に迷子になり、さらにすべてのリターンをlistview2に入れたいと思っています。
//SOAP
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("code", code);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true; // Set this variable to true for
// compatibility with what seems to be the default encoding for.Net-Services.
envelope.setOutputSoapObject(request);
System.out.println(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
Log.i("myApp", response.toString());
System.out.println("response " +response);
}catch(SocketException ex)
{
Log.e("Error : " , "Error on soapPrimitiveData() " + ex.getMessage());
ex.printStackTrace();
}
catch (Exception e) {
Log.e("Error : " , "Error on soapPrimitiveData() " + e.getMessage());
e.printStackTrace();
}
}
}
}