Search code examples
androidonresumegoogle-maps-android-api-2

Android Google Maps API v2 calling getProjection from onResume


I need to get the map bound when my app starts, but

    GoogleMap.getProjection().getVisibleRegion().latLngBounds;

returns the bounds 0,0,0,0. Is there some kind of listener I could use to see when the

    Projection

is loaded? Thank you in advance.


Solution

  • Register (temporarily, if needed) an OnCameraChangeListener. It will get called whenever the camera changes, which will include the first change when the default map is displayed.