private String generateUrl(GeoObj startPos, GeoObj destPos, boolean byWalk) {
   // build the url string:
   StringBuilder urlString = new StringBuilder();
   urlString.append("http://maps.google.com/maps?f=d&hl=en");
   if (byWalk) {
     urlString.append("&dirflg=w");
   }
   urlString.append("&saddr="); // from
   urlString.append(Double.toString(startPos.getLatitude()));
   urlString.append(",");
   urlString.append(Double.toString(startPos.getLongitude()));
   urlString.append("&daddr="); // to
   urlString.append(Double.toString(destPos.getLatitude()));
   urlString.append(",");
   urlString.append(Double.toString(destPos.getLongitude()));
   urlString.append("&;ie=UTF8&0&om=0&output=kml");
   return urlString.toString();
 }
  /**
   * This method returns the best match for a specified position. It could for example be used to
   * calculate the closest address to your current location.
   *
   * @param location
   * @return the closest address to the {@link GeoObj}
   */
  public Address getBestAddressForLocation(GeoObj location) {
    try {
      List<Address> locations =
          myGeoCoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
      if (locations.size() > 0) {
        return locations.get(0);
      }

    } catch (IOException e) {
      e.printStackTrace();
    }
    return null;
  }