Android Distance Calculate toDistanceSearchUri(Uri contentUri, Location location, double distance)

Here you can find the source of toDistanceSearchUri(Uri contentUri, Location location, double distance)

Description

Makes a URI that queries the locatable item by distance.

License

Open Source License

Parameter

Parameter Description
contentUri the LocatableUtils content URI to build upon. Must be a dir, not an item.
location center point
distance distance in meters

Declaration

public static Uri toDistanceSearchUri(Uri contentUri,
        Location location, double distance) 

Method Source Code

//package com.java2s;
/*/*from   ww  w  .j  a  va 2s .c  o  m*/
 * Copyright (C) 2010  MIT Mobile Experience Lab
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

import android.location.Location;
import android.net.Uri;

public class Main {
    public static final String SERVER_QUERY_PARAMETER = "dist";

    /**
     * Makes a URI that queries the locatable item by distance.
     *
     * @param contentUri
     *            the LocatableUtils content URI to build upon. Must be a dir, not an item.
     * @param location
     *            center point
     * @param distance
     *            distance in meters
     * @return
     */
    public static Uri toDistanceSearchUri(Uri contentUri,
            Location location, double distance) {
        return contentUri
                .buildUpon()
                .appendQueryParameter(
                        SERVER_QUERY_PARAMETER,
                        location.getLongitude() + ","
                                + location.getLatitude() + "," + distance)
                .build();
    }
}

Related

  1. calculateEte(boolean useBearing, double distance, double speed, double bearing, double heading)
  2. fetchRawEte(boolean useBearing, double distance, double speed, double bearing, double heading)
  3. distance(double lat1, double lon1, double lat2, double lon2, char unit)
  4. computeSpeed(int distance, long duration)
  5. getClosestStore(ArrayList storeIds, SparseArray distanceMap)
  6. getDisplay(Activity activity)