0
我用來從下面的代碼JSON
數據,但現在HttpClient
棄用再也看不到了。請問你能幫幫我嗎?如何從JSON數據 - HttpClient的過時
String responseString = null;
try {
HttpClient client = new DefaultHttpClient();
URI apiCall = new URI("...");
HttpGet request = new HttpGet();
request.setURI(apiCall);
HttpResponse response = client.execute(request);
responseString = EntityUtils.toString(response.getEntity());
} catch (Exception e) {
Log.e("TAG", "some sort of problem encountered", e);
}
https://stackoverflow.com/questions/32380439/namevaluepair-error-namevaluepair-cannot-be-resolved-to-a-type – CommonsWare
感謝另一個類評論@CommonsWare,如果你寫一個答案,我會接受它是正確的。 但爲什麼如果我用https://hc.apache.org/httpcomponents-client-4.3.x/android-port.html或http://developer.android.com/preview/behavior-changes.html編譯我的gradle #behavior-apache-http-client我的代碼不正確? – Pier
@CommonsWare:看起來像你標記另一個重複問題的副本:-) – BNK