Can anyone explain the difference between
OnMapReadyCallback.OnMapReady(GoogleMap googleMap)
and
GoogleMap.OnMapLoadedCallback.OnMapLoaded()
It is not very clear to me.
public interface OnMapReadyCallback. Callback interface for when the map is ready to be used. Once an instance of this interface is set on a MapFragment or MapView object, the onMapReady(GoogleMap) method is triggered when the map is ready to be used and provides a non-null instance of GoogleMap .
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With