簡單來說妳只需要3步, 1/ajax/services/search/images"; AsyncHttpClient client = new AsyncHttpClient(); RequestParams params = new RequestParams(); params.put("q", "android"); params.put("rsz", "8"); client.get(url, params, new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { // Handle resulting parsed JSON response here } @Override public void onSuccess(int statusCode, Header[] headers, JSONArray response) { // Handle resulting parsed JSON response here } }); 看到了沒,返回的response已經自動轉化成JSONObject了,當然也支持JSONArray類型,override妳需要的那個版本就行。 有了AsyncHttpClient,要實現這些功能是不是很簡單呢?當然這裏只是很初級的介紹和使用,剩下的還需要開發者自己參考官方 文檔、源碼(官方甚至提供了壹個Sample使用的集合),在實際項目中實踐。最後,強烈建議大家使用,是時候和冗長乏味的代碼說
上一篇:易語言 網頁操作思路下一篇:Delphi數據庫查詢TdxDBTreeList記錄不顯示問題