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
. Как распечатать ответ в Logger or console.
response.toString()
или response.getEntity.toString()
не работает.Получение ответа JSON Android
Должен ли я установить Content-type как "application/json"
.
и сущность - это ничего, кроме response.getEntity() справа? – Kevin
Последний вопрос: как установить тип содержимого: 'application/json' на мой http – Kevin
yes, entity - response.getEntity() –