Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
Posts: 25
Registered: ‎04-07-2011
My Device: All
My Carrier: Any
Accepted Solution

Blackberry maps

Hi newbie here- so bare with me:

Although I can pin a location on a Blackberry map, if it is done on a whole worls scale, I can see it fine.

However, if I try to do it zoomed in on the location, I just get a blank map (with the pin inserted in the correct lat- long).

Any ideas? 

public RichMapField map= MapFactory.getInstance().generateRichMapField();
public MapDataModel Mapdata = map.getModel();
public MapLocation currentLocation = new MapLocation( storedLat, storedLong, storedDateTime, null );

private void setLocation(double storedLat, double storedLong,String storedDateTime )
{
 try
 {
  Mapdata = map.getModel();
  Mapdata.removeAll();
  
  MapAction action = map.getAction();
  currentLocation = new MapLocation( storedLat,storedLong, storedDateTime, null);
   
  int locId = Mapdata.add( (Mappable) currentLocation, "CurrentLocation");
         
  action.setCentreAndZoom(new MapPoint(storedLat, storedLong),2);
    
  Mapdata.setVisibleNone();
  Mapdata.tag( locId, "Location");
  Mapdata.setVisible( "Location" );

  map.getMapField().update( true );
 }
 catch (Exception ex)
 {
      System.out.println("Error mapping" + ex.getMessage());
          
 }
}

Many thanks in advance!

Developer
Posts: 166
Registered: ‎01-14-2009
My Device: Curve 8330

Re: Blackberry maps

Hello,

first, is your MDS started when you try this? What OS / Device are you testing on?

Thank you, have a nice day.

--
Samuel D.
Contributor
Posts: 25
Registered: ‎04-07-2011
My Device: All
My Carrier: Any

Re: Blackberry maps

 
Highlighted
Developer
Posts: 254
Registered: ‎03-15-2011
My Device: simulator
My Carrier: simulator

Re: Blackberry maps

I think u have zoomed to the maximum extent that is possible and grey area around the location fills the display.

 

Can u zoom out a little bit and verify if you still face the problem?

 

If you dont face any issue, then it is not a problem at all and only the expected behaviour.

------------------------------------------------------------------------------------------------
Click "Accept as Solution" if post was what you needed. Give kudos if you feel response is helpful.

Contributor
Posts: 25
Registered: ‎04-07-2011
My Device: All
My Carrier: Any

Re: Blackberry maps

(Apologies when I try to reply- it fails- I'm now trying a Quick Reply)
Thanks for that!
I'm using Eclipse with the blackberry Plugins, testing on on a device rather than a simulator (on a Blackberrt Torch 9800, software version 6.0.0.246.
I'll have a look into the zoom, and get back to you.
Contributor
Posts: 25
Registered: ‎04-07-2011
My Device: All
My Carrier: Any

Re: Blackberry maps

Ok- I've been pplaying with this on and off all day.

I've now rewritten it along the lines of an example I know works.
I could get that working with at Lat Long of
45.504512,-73.557029
but if I use:
51.060130,-1.339557
I still get a blank page.

I'm using;
currentLocation = new MapLocation( DEFAULT_LAT, DEFAULT_LONG, currentTime, "Location" );
Mapdata.add((Mappable) currentLocation );
map.getMapField().update( true );

How do I zoom out using this method?

Many thanks
Developer
Posts: 166
Registered: ‎01-14-2009
My Device: Curve 8330

Re: Blackberry maps

You can call map.setZoom() that need a int for the zoom level. I usually override the keyDown of the MapField to handle zoom level with the keyboard.
Thank you, have a nice day.

--
Samuel D.
Contributor
Posts: 25
Registered: ‎04-07-2011
My Device: All
My Carrier: Any

Re: Blackberry maps

Cheers!

What is the range for zoom? I've seen 2 as a value- what does that mean? (I bet it's a dumb question!)

I think it is the zoom- but I'm at home now- so I'll have to try it at work tomorrow.

Have a good evening!
Developer
Posts: 166
Registered: ‎01-14-2009
My Device: Curve 8330

Re: Blackberry maps

The zoom level vary between map.getMaxZoom() et map.getMinZoom(). Here is the documentation desctibing all available method:

http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/lbs/MapField.html
Thank you, have a nice day.

--
Samuel D.
Contributor
Posts: 25
Registered: ‎04-07-2011
My Device: All
My Carrier: Any

Re: Blackberry maps

Hi
The method getMaxZoom() is not available- I'm using RichMapField rather than MapField.
(See start of thread).
How can I achieve this with the RichMapField?
Many thanks