public class SupportMapFragment extends Fragment implements OnMapReadyCallback
A Map component in an app. This fragment is the simplest way to place a map in an application. It's a wrapper around a view of a map to automatically handle the necessary life cycle needs. Being a fragment, this component can be added to an activity's layout or can dynamically be added using a FragmentManager.
To get a reference to the MapView, use getMapAsync(OnMapReadyCallback)
}
getMapAsync(OnMapReadyCallback)
Fragment.InstantiationException, Fragment.SavedState
Constructor and Description |
---|
SupportMapFragment() |
Modifier and Type | Method and Description |
---|---|
void |
getMapAsync(OnMapReadyCallback onMapReadyCallback)
Sets a callback object which will be triggered when the MapboxMap instance is ready to be used.
|
static SupportMapFragment |
newInstance()
Creates a default MapFragment instance
|
static SupportMapFragment |
newInstance(MapboxMapOptions mapboxMapOptions)
Creates a MapFragment instance
|
View |
onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState)
Creates the fragment view hierarchy.
|
void |
onDestroyView()
Called when the fragment is view hiearchy is being destroyed.
|
void |
onLowMemory()
Called when the fragment receives onLowMemory call from the hosting Activity.
|
void |
onMapReady(MapboxMap mapboxMap)
Called when the map is ready to be used.
|
void |
onPause()
Called when the fragment is pausing.
|
void |
onResume()
Called when the fragment is ready to be interacted with.
|
void |
onSaveInstanceState(Bundle outState)
Called when the fragment state needs to be saved.
|
void |
onStart()
Called when the fragment is visible for the users.
|
void |
onStop()
Called when the fragment is no longer visible for the user.
|
void |
onViewCreated(View view,
Bundle savedInstanceState)
Called when the fragment view hierarchy is created.
|
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, hashCode, hasOptionsMenu, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isVisible, onActivityCreated, onActivityResult, onAttach, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreate, onCreateAnimation, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onInflate, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPictureInPictureModeChanged, onPrepareOptionsMenu, onRequestPermissionsResult, onViewStateRestored, postponeEnterTransition, registerForContextMenu, requestPermissions, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenu
public static SupportMapFragment newInstance()
public static SupportMapFragment newInstance(@Nullable MapboxMapOptions mapboxMapOptions)
mapboxMapOptions
- The configuration options to be used.public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
onCreateView
in class Fragment
inflater
- Inflater used to inflate content.container
- The parent layout for the map fragment.savedInstanceState
- The saved instance state for the map fragment.public void onViewCreated(View view, Bundle savedInstanceState)
onViewCreated
in class Fragment
view
- The content view of the fragmentsavedInstanceState
- THe saved instance state of the framgntpublic void onMapReady(MapboxMap mapboxMap)
OnMapReadyCallback
onMapReady
in interface OnMapReadyCallback
mapboxMap
- An instance of MapboxMap associated with the MapFragment
or
MapView
that defines the callback.public void onStart()
public void onResume()
public void onPause()
public void onSaveInstanceState(@NonNull Bundle outState)
onSaveInstanceState
in class Fragment
outState
- The saved statepublic void onStop()
public void onLowMemory()
onLowMemory
in interface ComponentCallbacks
onLowMemory
in class Fragment
public void onDestroyView()
onDestroyView
in class Fragment
public void getMapAsync(@NonNull OnMapReadyCallback onMapReadyCallback)
onMapReadyCallback
- The callback to be invoked.© 2015–2018 Mapbox. All rights reserved.