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 blocke.printStackTrace();}} catch (ClientProtocolException e1) {// TODO Auto-generated catch blocke1.printStackTrace();} catch (IOException e1) {// TODO Auto-generated catch blocke1.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;}

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. 在SQL触发器或存储过程中获取在程序登录
  2. 判断字段是否被更新 新旧数据写入Audit L
  3. 判断触发器正在处理的是插入,删除还是更新
  4. sqlserver 动态创建临时表的语句分享
  5. OBJECTPROPERTY与sp_rename更改对象名称
  6. SQL 统计一个数据库中所有表记录的数量
  7. sqlserver 导出插入脚本代码
  8. sp_executesql 使用复杂的Unicode 表达式
  9. MSSQL MySQL 数据库分页(存储过程)
  10. 此数据库没有有效所有者,因此无法安装数据