共用方式為


Geocoder.GetFromLocation Method

Definition

Overloads

GetFromLocation(Double, Double, Int32)

Returns an array of Addresses that attempt to describe the area immediately surrounding the given latitude and longitude.

GetFromLocation(Double, Double, Int32, Geocoder+IGeocodeListener)

GetFromLocation(Double, Double, Int32)

Returns an array of Addresses that attempt to describe the area immediately surrounding the given latitude and longitude.

[Android.Runtime.Register("getFromLocation", "(DDI)Ljava/util/List;", "")]
public System.Collections.Generic.IList<Android.Locations.Address>? GetFromLocation (double latitude, double longitude, int maxResults);
[<Android.Runtime.Register("getFromLocation", "(DDI)Ljava/util/List;", "")>]
member this.GetFromLocation : double * double * int -> System.Collections.Generic.IList<Android.Locations.Address>

Parameters

latitude
Double

the latitude a point for the search

longitude
Double

the longitude a point for the search

maxResults
Int32

max number of addresses to return. Smaller numbers (1 to 5) are recommended

Returns

a list of Address objects. Returns null or empty list if no matches were found or there is no backend service available.

Attributes

Exceptions

if latitude is less than -90 or greater than 90

if longitude is less than -180 or greater than 180

if the network is unavailable or any other I/O problem occurs

Remarks

Returns an array of Addresses that attempt to describe the area immediately surrounding the given latitude and longitude. The returned addresses should be localized for the locale provided to this class's constructor.

<p class="warning"><strong>Warning:</strong> Geocoding services may provide no guarantees on availability or accuracy. Results are a best guess, and are not guaranteed to be meaningful or correct. Do <b>NOT</b> use this API for any safety-critical or regulatory compliance purposes.</p>

<p class="warning"><strong>Warning:</strong> This API may hit the network, and may block for excessive amounts of time, up to 60 seconds or more. It's strongly encouraged to use the asynchronous version of this API. If that is not possible, this should be run on a background thread to avoid blocking other operations.</p>

This member is deprecated. Use #getFromLocation(double, double, int, GeocodeListener) instead to avoid blocking a thread waiting for results.

Java documentation for android.location.Geocoder.getFromLocation(double, double, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

GetFromLocation(Double, Double, Int32, Geocoder+IGeocodeListener)

[Android.Runtime.Register("getFromLocation", "(DDILandroid/location/Geocoder$GeocodeListener;)V", "", ApiSince=33)]
public void GetFromLocation (double latitude, double longitude, int maxResults, Android.Locations.Geocoder.IGeocodeListener listener);
[<Android.Runtime.Register("getFromLocation", "(DDILandroid/location/Geocoder$GeocodeListener;)V", "", ApiSince=33)>]
member this.GetFromLocation : double * double * int * Android.Locations.Geocoder.IGeocodeListener -> unit

Parameters

latitude
Double
longitude
Double
maxResults
Int32
Attributes

Applies to