Here you can find the source of toDistanceSearchUri(Uri contentUri, Location location, double distance)
Parameter | Description |
---|---|
contentUri | the LocatableUtils content URI to build upon. Must be a dir, not an item. |
location | center point |
distance | distance in meters |
public static Uri toDistanceSearchUri(Uri contentUri, Location location, double distance)
//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(); } }