Open BlackBerry Maps by using specific coordinates

You can open BlackBerry® Maps to display a location on a map by providing the coordinates for the latitude and longitude of a location and by specifying the zoom and rotation values. The zoom values have a range of 0 to MapView.MAX_ZOOM. The rotation values are expressed in degrees to rotate the map from north facing up, and have a range of 0 to 359.
  1. Import the required classes.
    import net.rim.blackberry.api.invoke.*;
    import net.rim.blackberry.api.maps.*;
  2. Create a class and constructor to use to invoke BlackBerry Maps.
    public class invokeMaps
    {
        public invokeMaps ()
        {
        }
    }
  3. In the constructor, create an instance of the MapView class. Invoke MapView.setLatitude(), MapView.setLongitude(), and MapView.setZoom() to specify the coordinates and zoom that you want to use.
    MapView mapView = new MapView();
    mapView.setLatitude(4328915);
    mapView.setLongitude(-8032480);
    mapView.setZoom(10);
  4. In the constructor, create an instance of the MapsArguments class using the MapView object as an argument. Invoke Invoke.invokeApplication() to open BlackBerry Maps and pass in the MapsArguments object.
    MapsArguments mapsArgs = new MapsArguments(mapView);
    Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, mapsArgs);

Code sample: Invoking BlackBerry Maps by using specific coordinates

import net.rim.blackberry.api.invoke.*;
import net.rim.blackberry.api.maps.*;

public class invokeMaps
{
    public invokeMaps()
    {
        MapView mapView = new MapView();
        mapView.setLatitude(4328915);
        mapView.setLongitude(-8032480);
        mapView.setZoom(10);
        MapsArguments mapsArgs = new MapsArguments(mapView);
        Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, mapsArgs);
    }
}

Was this information helpful? Send us your comments.