mapbox-gl-native
mapbox-gl-native copied to clipboard
addOnMapChangedListener() with SupportMapFragment
Method addOnMapChangedListener() is only exist on MapView. How can I use this with MapFragment? Or how can I get the MapView in MapFragment?
@vfaSonnt Thank you for reaching out. There is a method called:
/**
* Sets a callback object which will be triggered when the MapboxMap instance is ready to be used.
*
* @param onMapReadyCallback The callback to be invoked.
*/
public void getMapAsync(@NonNull final OnMapReadyCallback onMapReadyCallback) {
mOnMapReadyCallback = onMapReadyCallback;
}
You can use this to get a reference to MapboxMap. From the 4.0.0 release user will no longer interact with the MapView directly, but with the MapboxMap. Look at this as a separation of concerns, MapboxMap is the controller, MapView is the view.
All our activities in our TestApp are updated to reflect these changes: