2014年12月11日 星期四

Android-筆記 HttpGet


     private String httpGetData(String url) {
          
          String strResult = null;

          try {
              HttpGet get = new HttpGet(url);
              HttpResponse httpResponse = new DefaultHttpClient().execute(get);
              strResult = EntityUtils.toString(httpResponse.getEntity(), HTTP.UTF_8);
          } catch (ClientProtocolException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }

          return strResult;
      }

沒有留言:

張貼留言