HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(URL);
try {
StringEntity documentStringified = new StringEntity(Obj.toString());
httpPost.setEntity(documentStringified);
} catch (UnsupportedEncodingException e) {
Log.d("UnsupportedEncodingException", e.toString());
}
try {
HttpResponse response = httpClient.execute(httpPost);
Log.d("Response", response.toString());
} catch (IOException e) {
Log.d("IOException", e.toString());
}
response
을 얻을 수 없습니다. response.toString()
또는 response.getEntity.toString()
의 응답을 인쇄하는 방법이 작동하지 않습니다.JSON 응답 받기 Android
콘텐츠 유형을 "application/json"
으로 설정해야합니까?
엔티티는 response.getEntity()입니다. 그렇습니까? – Kevin
마지막 질문입니다. content-type : 'application/json'을 내 http – Kevin
으로 설정하는 방법 예, 엔티티는 response.getEntity() –