Embedding a map in an application

You can embed a map in your BlackBerry® device application by using the net.rim.device.api.lbs.MapField class. MapField extends the net.rim.device.api.ui.Field class to render a map by using the current mapping service, and it provides methods to change the position and view of the current map.

Method

Description

move(int, int)

Moves the position of the map by a certain number of pixels.

moveTo(Coordinates)

Moves the position of the the map to the location specified by a Coordinate object.

moveTo(int, int)

Moves the postion of the map to the specified coordinates for latitude and longitude.

setRotation(int)

Rotates the current map view.

setZoom(int)

Changes the zoom level of the current map view.

In the moveTo method, you can use world coordinates for the latitudinal and longitudinal coordinates. Valid ranges for latitude are -9000000 to +9000000, and ranges for longitude are -18000000 to +18000000. Some methods in the MapField class throw an IllegalArgumentException if the passed or calculated coordinates are out of range.


Was this information helpful? Send us your comments.