It work's at Smartphone(Android 2.3.3) but Tablet(Android 4.0) => Force Close!!
public String getXmlFromUrl(String url) {
String xml = null;
try {
// defaultHttpClient
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
HttpResponse httpResponse = httpClient.execute(httpPost); // HERE FORCE CLOSE, why???
HttpEntity httpEntity = httpResponse.getEntity();
xml = EntityUtils.toString(httpEntity);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
// return XML
return xml;
}
Any suggestion with example?
catch (Throwable t) { t.printStackTrace(); }Then see what it prints to your error log. – ZeroOne Nov 29 '12 at 15:34