public class AndroidGeocoder
extends java.lang.Object
| Constructor and Description |
|---|
AndroidGeocoder(android.content.Context context)
Constructs a Geocoder whose responses will be localized for the
default system Locale.
|
AndroidGeocoder(android.content.Context context,
java.util.Locale locale)
Constructs a Geocoder whose responses will be localized for the
given Locale.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<android.location.Address> |
getFromLocation(double latitude,
double longitude,
int maxResults)
Returns an array of Addresses that are known to describe the
area immediately surrounding the given latitude and longitude.
|
java.util.List<android.location.Address> |
getFromLocationName(java.lang.String locationName,
int maxResults)
Returns an array of Addresses that are known to describe the
named location, which may be a place name such as "Dalvik,
Iceland", an address such as "1600 Amphitheatre Parkway,
Mountain View, CA", an airport code such as "SFO", etc..
|
java.util.List<android.location.Address> |
getFromLocationName(java.lang.String locationName,
int maxResults,
double lowerLeftLatitude,
double lowerLeftLongitude,
double upperRightLatitude,
double upperRightLongitude)
Returns an array of Addresses that are known to describe the
named location, which may be a place name such as "Dalvik,
Iceland", an address such as "1600 Amphitheatre Parkway,
Mountain View, CA", an airport code such as "SFO", etc..
|
static boolean |
isPresent()
Returns true if the Geocoder methods getFromLocation and
getFromLocationName are implemented.
|
void |
setAccessToken(java.lang.String accessToken) |
public AndroidGeocoder(android.content.Context context,
java.util.Locale locale)
context - the Context of the calling Activitylocale - the desired Locale for the query resultsjava.lang.NullPointerException - if Locale is nullpublic AndroidGeocoder(android.content.Context context)
context - the Context of the calling Activitypublic static boolean isPresent()
public java.util.List<android.location.Address> getFromLocation(double latitude,
double longitude,
int maxResults)
throws java.io.IOException
The returned values may be obtained by means of a network lookup. The results are a best guess and are not guaranteed to be meaningful or correct. It may be useful to call this method from a thread separate from your primary UI thread.
latitude - the latitude a point for the searchlongitude - the longitude a point for the searchmaxResults - max number of addresses to return. Smaller numbers (1 to 5) are recommendedjava.lang.IllegalArgumentException - if latitude is
less than -90 or greater than 90java.lang.IllegalArgumentException - if longitude is
less than -180 or greater than 180java.io.IOException - if the network is unavailable or any other
I/O problem occurspublic java.util.List<android.location.Address> getFromLocationName(java.lang.String locationName,
int maxResults)
throws java.io.IOException
The query will block and returned values will be obtained by means of a network lookup. The results are a best guess and are not guaranteed to be meaningful or correct. It may be useful to call this method from a thread separate from your primary UI thread.
locationName - a user-supplied description of a locationmaxResults - max number of results to return. Smaller numbers (1 to 5) are recommendedjava.lang.IllegalArgumentException - if locationName is nulljava.io.IOException - if the network is unavailable or any other
I/O problem occurspublic java.util.List<android.location.Address> getFromLocationName(java.lang.String locationName,
int maxResults,
double lowerLeftLatitude,
double lowerLeftLongitude,
double upperRightLatitude,
double upperRightLongitude)
throws java.io.IOException
You may specify a bounding box for the search results by including the Latitude and Longitude of the Lower Left point and Upper Right point of the box.
The query will block and returned values will be obtained by means of a network lookup. The results are a best guess and are not guaranteed to be meaningful or correct. It may be useful to call this method from a thread separate from your primary UI thread.
locationName - a user-supplied description of a locationmaxResults - max number of addresses to return. Smaller numbers (1 to 5) are recommendedlowerLeftLatitude - the latitude of the lower left corner of the bounding boxlowerLeftLongitude - the longitude of the lower left corner of the bounding boxupperRightLatitude - the latitude of the upper right corner of the bounding boxupperRightLongitude - the longitude of the upper right corner of the bounding boxjava.lang.IllegalArgumentException - if locationName is nulljava.lang.IllegalArgumentException - if any latitude is
less than -90 or greater than 90java.lang.IllegalArgumentException - if any longitude is
less than -180 or greater than 180java.io.IOException - if the network is unavailable or any other
I/O problem occurspublic void setAccessToken(java.lang.String accessToken)