HttpClient httpClient = new DefaultHttpClient();
HttpGet httpget = new HttpGet("http://www.example.com");
String result = null;
ResponseHandler<String> responseHandler = new BasicResponseHandler();
try {
result = httpClient.execute(httpget, responseHandler); // this result will have the response received from server
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Toast.makeText(getApplicationContext(), result, Toast.LENGTH_LONG).show(); // Toast the response received
안녕하세요, Bhavit, 빠른 답장을 보내 주셔서 감사합니다. 나는 당신이 응답을 정의하는 곳을 안다 –
나는 그 대답을 실제로 편집했다. "결과" –
고마워, 곧 시험해 보겠다. 어쨌든 - 이것은 작동 대답으로 보이지 않습니다. 예외가 던져지면 결과는 null이 될 것입니다. 그렇지 않습니까? 내가 응답에서 벗어날 수 있다고 생각하십니까? 그럴 때 핸들러? –