BlackBerry RichMapField is blank on device

610 Views Asked by At

I use RichMapField like below to display Blackberry Maps in my application.

RichMapField map = MapFactory.getInstance().generateRichMapField(); 
add(map);

The map is displayed properly on the BlackBerry simulator, but on a device the map field is blank.

Edited:

This is some part of my code. The code given below adds 2 markers to the map, which works perfectly fine, but the only problem is i don't see the map.

  MapLocation Location1 = new MapLocation(coordinates[0],coordinates[1],"Location 1",null);
       int Location1ID = data.add((Mappable)Location1,"Location 1");
       data.tag(Location1ID, "Location1");

       MapLocation Location2 = new MapLocation(coordinates[0]-0.00009,coordinates[1]- 0.00009,"Location 2",null);
       int Location2ID = data.add((Mappable)Location2,"Location 2");
       data.tag(Location2ID, "Location2");     

       data.setVisible("Location");             
       map.getMapField().update(true)
2

There are 2 best solutions below

1
On

Add the following:

map.getAction().setCentreLatLon(coordinates[0],coordinates[1]);
map.getAction().setZoom(0);

I think this way you will see the map now. For some reason I'm still investigating, the map.getAction().update(true); isn't working well for me too.

2
On

depends on your screen painting method. If your override your screen in such a way that u repaint ur screen on top of ur map, you obviously cant see the map.

Can you try pasting more code and ur paint method. It will help.