1 ページの xml 応答を文字列で取得したいのですが、スクリプトが常にシャットダウンします。何が問題なのか分かりますか? マニフェストで私は取る:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
コード:
String URL = "http://sample.com/test.xml";
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(URL);
try {
response = httpclient.execute(httppost);
} catch (ClientProtocolException e1) {
// TODO Auto-generated catch block
} catch (IOException e1) {
// TODO Auto-generated catch block
}
HttpEntity r_entity = response.getEntity();
try {
xmlString = EntityUtils.toString(r_entity);
String s = "2";
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}