android.location
public
final
class
android.location.Geocoder
A class for handling geocoding and reverse geocoding. Geocoding is
the process of transforming a street address or other description
of a location into a (latitude, longitude) coordinate. Reverse
geocoding is the process of transforming a (latitude, longitude)
coordinate into a (partial) address. The amount of detail in a
reverse geocoded location description may vary, for example one
might contain the full street address of the closest building, while
another might contain only a city name and postal code.
Note: this class is currently a mock-only. See
this
page for more details on how to specify data for the mock.
Summary
Public Constructors
Public Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Public Constructors
public
Geocoder(Locale locale)
Constructs a Geocoder whose responses will be localized for the
given Locale.
public
Geocoder()
Constructs a Geocoder whose responses will be localized for the
default system Locale.
Public Methods
public
Address[]
getFromBusinessName(String businessName, double centerLatitude, double centerLongitude, double latitudeSpan, double longitudeSpan)
Returns an array of Addresses that are known to describe the
named location, which may be the name of a business or a
description such as "pizza in new york city". The returned
addresses will be localized for the locale provided to this
class's constructor.
The search will be centered around (centerLatitude, centerLongitude)
with a suggested diameter given by latitudeSpan and longitudeSpan.
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.
Parameters
| businessName
| a user-supplied description of a business |
| centerLatitude
| the latitude of a central point for the search |
| centerLongitude
| the longitude of a central point for the search |
| latitudeSpan
| the number of degrees of latitude in which to search |
| longitudeSpan
| the number of degrees of longitude in
which to search |
Returns
- an array of Address objects or null if no matches were found.
public
Address[]
getFromLocation(double latitude, double longitude)
Returns an array of Addresses that are known to describe the
area immediately surrounding the given latitude and longitude.
The returned addresses will be localized for the locale
provided to this class's constructor.
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.
Parameters
| latitude
| the latitude a point for the search |
| longitude
| the longitude a point for the search |
Returns
- an array of Address objects or null if no matches were
found.
Throws
| IOException
| if the network is unavailable or any other
I/O problem occurs
|
public
Address[]
getFromLocationName(String locationName, double centerLatitude, double centerLongitude, double latitudeSpan, double longitudeSpan)
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.. The
returned addresses will be localized for the locale provided to
this class's constructor.
The search will be centered around (centerLatitude, centerLongitude)
with a suggested diameter given by latitudeSpan and longitudeSpan.
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.
Parameters
| locationName
| a user-supplied description of a location |
| centerLatitude
| the latitude of a central point for the search |
| centerLongitude
| the longitude of a central point for the search |
| latitudeSpan
| the number of degrees of latitude in which to search |
| longitudeSpan
| the number of degrees of longitude in
which to search |
Returns
- an array of Address objects or null if no matches were found.