Map field

Use a map field to display a map in a BlackBerry® device application.

Class MapField
Supported since BlackBerry® Java® SDK 6.0
Example This screen shows a map.

For more information about map fields and location-based services, see the Location-Based Services Development Guide.

Code sample: Creating a map field

import net.rim.device.api.lbs.maps.model.*;
import net.rim.device.api.lbs.maps.ui.*;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.container.*;

public class MapFieldDemo extends UiApplication
{
    public static void main(String[] args)
    {
        MapFieldDemo theApp = new MapFieldDemo();
        theApp.enterEventDispatcher();
    }
    public MapFieldDemo()
    {
        pushScreen(new MapScreen());
    }
}

class MapScreen extends FullScreen
{
    public MapScreen() 
    {
        super( FullScreen.DEFAULT_CLOSE | FullScreen.DEFAULT_MENU );
        MapField map = new MapField();
        MapAction action = map.getAction();
        action.setCentreAndZoom(new MapPoint(43.46518, -80.52237), 3);   
        add(map);
    }
}
Next topic: Provide feedback
Previous topic: Title bar

Was this information helpful? Send us your comments.