Can anyone explain the difference between
OnMapReadyCallback.OnMapReady(GoogleMap googleMap)
and
GoogleMap.OnMapLoadedCallback.OnMapLoaded()
It is not very clear to me.
Can anyone explain the difference between
OnMapReadyCallback.OnMapReady(GoogleMap googleMap)
and
GoogleMap.OnMapLoadedCallback.OnMapLoaded()
It is not very clear to me.
It basically depends upon what you want to do with the map.
You can safely use OnMapReadyCallback to set your pins, etc. It is called as soon as the map is ready for you to use it.
OnMapLoadedCallback, as the docs state, is called
When the map has finished rendering. This occurs after all tiles required to render the map have been fetched, and all labeling is complete. eg. the map's content is fully loaded and visible.
This happens later than OnMapReady. The call googleMap.setOnMapLoadedCallback even implies that OnMapReady already happened to be able to be called safely (googleMap != null).
googleMap.animateCamera()
after OnMapReady
: Error using newLatLngBounds(LatLngBounds, int): Map size can't be 0. Most likely, layout has not yet occured for the map view. Either wait until layout has occurred or use newLatLngBounds(LatLngBounds, int, int, int) which allows you to specify the map's dimensions.
Would the issue be resolved is I call it after OnMapLoaded
?
– Daniele B
Aug 30 '16 at 16:57
googleMap.setOnMapLoadedCallback
– Daniele B
Aug 30 '16 at 17:09