Retrieve location information for an address that is stored in a String
A request for information invoking Locator.geocode() can result in a LocationException if the request fails.
- Import the following classes:
- javax.microedition.location.Coordinates
- net.rim.device.api.lbs.Locator
- javax.microedition.location.Landmark
- javax.microedition.location.LocationException
- Create a String object that contains address information.
String Address = “Waterloo, Canada”;
- Create a Coordinates object that the locator server for location-based services uses as a starting location to search for location information for an address.
Coordinates co = new Coordinates(43.46518, -80.52237, 0);
- Invoke Locator.geocode(String freeformString, Coordinates startCoords) and assign the value that the method returns to a Landmark array.
Landmark[] = Locator.geocode(sAddress, co);
Was this information helpful? Send us your comments.