Stay organized with collections Save and categorize content based on your preferences.
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
.
If Google Play services is not installed on the device, the user will be prompted to install it, and the onMapReady(GoogleMap)
method will only be triggered when the user has installed it and returned to the app.
Called when the map is ready to be used.
Note that this does not guarantee that the map has undergone layout. Therefore, the map's size may not have been determined by the time the callback method is called. If you need to know the dimensions or call a method in the API that needs to know the dimensions, get the map's View
and register an ViewTreeObserver.OnGlobalLayoutListener
as well.
Do not chain the OnMapReadyCallback
and OnGlobalLayoutListener
listeners, but instead register and wait for both callbacks independently, since the callbacks can be fired in any order.
As an example, if you want to update the map's camera using a LatLngBounds
without dimensions, you should wait until both OnMapReadyCallback
and OnGlobalLayoutListener
have completed. Otherwise there is a race condition that could trigger an IllegalStateException
.
MapFragment
or MapView
that defines the callback.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["`OnMapReadyCallback` is triggered when the Google Map is ready to be used within a `MapFragment` or `MapView`."],["It provides a non-null `GoogleMap` object in the `onMapReady` method for developers to interact with."],["If Google Play services is missing, users will be prompted to install it before the callback is triggered."],["Map layout and dimensions may not be immediately available in `onMapReady`, requiring additional handling with `ViewTreeObserver.OnGlobalLayoutListener` for size-dependent operations."],["Avoid chaining `OnMapReadyCallback` and `OnGlobalLayoutListener`, instead register and wait for both independently to prevent potential race conditions."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4