我試圖使用Android系統的異步HTTP庫http://loopj.com/android-async-http/Android的異步HTTP庫GET HTTP響應頭
它建議使用此代碼:
public void getPublicTimeline() throws JSONException {
TwitterRestClient.get("statuses/public_timeline.json", null, new JsonHttpResponseHandler() {
@Override
public void onSuccess(JSONArray timeline) {
// Pull out the first event on the public timeline
JSONObject firstEvent = timeline.get(0);
String tweetText = firstEvent.getString("text");
// Do something with the response
System.out.println(tweetText);
}
});
}
}
但現在我的問題是我需要獲取響應對象,並且我還需要獲取http標頭。
如何獲取http標頭?
所有我需要的是能夠從響應訪問HTTP標頭。但是使用這個庫需要你給它一種HttpResponseHandler – Zapnologica