Code example for Location

Methods: distanceTosetLatitudesetLongitude

0
     * getDistance: determines the distance, in miles, between this Restaurant and the GeoPoint param 
     * @param pointA: the point from which the distance to the restaurant is being measured 
     * @return: the distance, in miles, between the two points. Is a float.  
     */ 
    public double getDistance(GeoPoint pointA){
        Location locationA = new Location("point A");
     
        locationA.setLatitude(pointA.getLatitudeE6() / 1E6);
        locationA.setLongitude(pointA.getLongitudeE6() / 1E6);
     
        Location locationB = new Location("point B");
     
        locationB.setLatitude(mLocation.getLatitudeE6() / 1E6);
        locationB.setLongitude(mLocation.getLongitudeE6() / 1E6);
     
        return roundDouble(locationA.distanceTo(locationB)/1609.34);//return in miles, not meters
    } 
     
    /** 
     * roundDouble: Takes in a Double value and rounds it to a single decimal place 
     * @param d: the Double value