String httpUrl = "http://api.hcl100.com/index.php/Applist/search/paging/0";                    /* 建立HTTP Get对象 */                    HttpGet httpRequest = new HttpGet(httpUrl);                    try {                        /* 发送请求并等待响应 */                        HttpResponse httpResponse = new DefaultHttpClient().execute(httpRequest);                        /* 若状态码为200 ok */                        if (httpResponse.getStatusLine().getStatusCode() == 200) {                            /* 读 */                            String strResult = EntityUtils.toString(httpResponse                                    .getEntity());                            /* 去没有用的字符 */                            System.out.println(strResult);                        } else {                            System.out.println("123123");                        }                    } catch (ClientProtocolException e) {                        e.printStackTrace();                    } catch (IOException e) {                        e.printStackTrace();                    } catch (Exception e) {                        e.printStackTrace();                    }


出现new DefaultHttpClient().execute(httpRequest)空的话 另开线程解决

更多相关文章

  1. 用Java 在 KSOAP中序列化复杂对象数组实体
  2. Android对象序列化存储
  3. Android GreenDao 建表及 获取SessionDao对象 单例
  4. Android EditText插入字符串到光标所在位置和删除
  5. android非法字符的判定、表情符号的判定
  6. Android将获取到文件的uri转换为字符串的路径
  7. android XML文件常用字符转义
  8. Android 创建一个包含星期的格式字符串
  9. Android源码快速查找文件、搜索字符串和编译

随机推荐

  1. Android中ScrollView布局初始化显示的时
  2. ubuntu连接android设备(附最简单方法)
  3. How to destroy an Activity in android
  4. Android Non-UI to UI Thread Communicat
  5. Android 获得屏幕分辨率
  6. android之实现各个组件点击事件监听
  7. CMAKE 在Linux下 构建android 编译、打包
  8. 短信接收--Android彩信的接收流程(应用层)
  9. Process 'command 'C:\zssinstallsoft\
  10. android 主线程和子线程之间的消息传递