private void GetResult(String channel_key, String session, String device_id, String api_version, String app_version, String timestamp, String platform_info, String sign) { JSONObject root; String url1 = "http://***.**.**.**:8080/TurboRadio/advertisements/list.json?channel_key=" + channel_key + "&device_id=" + device_id + "&api_version=" + api_version + "&app_version=" + app_version + "×tamp=" + timestamp + "&platform_info=" + platform_info + "&sign=" + sign; Log.i("url1", url1); System.out.println(url1); try { json = HttpDownload.getJSONData(url1); try { root = new JSONObject(json.toString()); Log.i("tag_root", root.toString()); String articles = root.getString("articles"); Log.i("tag_articles", articles.toString()); // JSONObject root1=new JSONObject(articles); // String id = root1.getString("id"); // Log.i("tag_id", id.toString()); // // String previous_cursor = root.getString("previous_cursor"); // Log.i("tag_previous_cursor", previous_cursor.toString()); // // String next_cursor = root.getString("next_cursor"); // Log.i("tag_next_cursor", next_cursor.toString()); // // String total_number = root.getString("total_number"); // Log.i("tag_total_number", total_number.toString()); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (ClientProtocolException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } private String PostResult(String channel_key, String session, String device_id, String api_version, String app_version, String timestamp, String platform_info, String sign) { try { HttpPost httpPost = new HttpPost( "http://***.**.**.**:8080/TurboRadio/advertisements/list.json"); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("channel_key", channel_key)); httpPost.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); // params.add(new BasicNameValuePair("session", session)); // httpPost.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); params.add(new BasicNameValuePair("device_id", device_id)); httpPost.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); params.add(new BasicNameValuePair("api_version", api_version)); httpPost.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); params.add(new BasicNameValuePair("app_version", app_version)); httpPost.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); params.add(new BasicNameValuePair("timestamp", timestamp)); httpPost.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); params.add(new BasicNameValuePair("platform_info", platform_info)); httpPost.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); params.add(new BasicNameValuePair("sign", sign)); httpPost.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); try { httpResponse = new DefaultHttpClient().execute(httpPost); Log.i("PostResult", "<--------"); if (httpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { result = EntityUtils.toString(httpResponse.getEntity()); Log.i("PostResult", "<--------" + result); } Log.i("tag", "end"); } catch (Exception e) { return null; } } catch (Exception e) { e.printStackTrace(); } return result; }