Ciao a tutti, questo e' ilmio primo post,spero di postare nella sez giusta.
Mi sto occupando dello sviluppo di un'applicazione che comunicando con il server ricev in risposta un array.
Semplicemente come posso recupeare questo array nel codice per poi elencare il tutto in una ListView?
Ho questo metodo per la richiest/risposta client/server:
codice:
public static String executeHttpPost(String url, ArrayList<NameValuePair> postParameters) throws Exception {
BufferedReader in = null;
try {
HttpClient client = getHttpClient();
HttpPost request = new HttpPost(url);
UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(postParameters);
request.setEntity(formEntity);
HttpResponse response = client.execute(request);
in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer sb = new StringBuffer("");
String line = "";
String NL = System.getProperty("line.separator");
while ((line = in.readLine()) != null) {
sb.append(line + NL);
}
in.close();
String result = sb.toString();
return result;
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
GRAZIE!