Daniele B
Daniele B

Reputation: 20442

Android maps: difference between OnMapReady() and OnMapLoaded()

Can anyone explain the difference between

OnMapReadyCallback.OnMapReady(GoogleMap googleMap)

and

GoogleMap.OnMapLoadedCallback.OnMapLoaded()

It is not very clear to me.

Upvotes: 8

Views: 4236

Answers (1)

Gaurav Sarma
Gaurav Sarma

Reputation: 2297

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).

Upvotes: 13

Related Questions