Code example for HttpClient

Methods: execute

0
                             loc.getLongitude());
    HttpGet getMethod=new HttpGet(url);
     
    try { 
      ResponseHandler<String> responseHandler=new BasicResponseHandler();
      String responseBody=client.execute(getMethod,
                                         responseHandler);
      buildForecasts(responseBody);
       
      String page=generatePage();
     
      browser.loadDataWithBaseURL(null, page, "text/html",
                                  "UTF-8", null); 
    } 
    catch (Throwable t) {
      android.util.Log.e("WeatherDemo", "Exception fetching data", t);
      Toast 
        .makeText(this, "Request failed: "+t.toString(), Toast.LENGTH_LONG)
        .show();
    } 
  }