Help Center

Local Navigation

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.

  1. Import the following classes:
    • javax.microedition.location.Coordinates
    • net.rim.device.api.lbs.Locator
    • javax.microedition.location.Landmark
    • javax.microedition.location.LocationException
  2. Create a String object that contains address information.
    String Address = “Waterloo, Canada”;
  3. 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);
  4. 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.