GoogleMapWidget: bounds not reset by programmatic change

Hi

I’m using the GoogleMapWidget in my app.

I want to display some points on the map as Markers and a line between them as a PolyOverlay. Furthermore, I want the map to be centered and zoomed in a way so that all of the Markers and the full line is visible and fills out most of the map.

I tried doing this by some calculations based on the getBoundsNE() and getBoundsSW() methods. The problem is that the return from these is not available in the constructor of the map (they return null) and they are not updated when you programmatically zoom or pan the map (by calling setZoom() and setCenter()).

Some research in the source code reveals that the return values are only updated when the changeVariables() is called on the map. As I understand it, this is done by the framework whenever the user does something to the map.

So, I have 2 questions:

  • Is there another better way to do what I want (make the map zoom and pan to display the markers properly)
  • If not, is there a way to force changeVariables() to be called. I could of course override the setZoom() and setCenter() methods and call changeVariables() explicitly, but what should be the parameter values in that case?

Regards
/ Fredrik Ferm