public final class MapFragment
extends android.app.Fragment
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)
Constructor and Description |
---|
MapFragment() |
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 MapFragment |
newInstance()
Creates a default MapFragment instance
|
static MapFragment |
newInstance(MapboxMapOptions mapboxMapOptions)
Creates a MapFragment instance
|
android.view.View |
onCreateView(android.view.LayoutInflater inflater,
android.view.ViewGroup container,
android.os.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 |
onPause()
Called when the fragment is pausing.
|
void |
onResume()
Called when the fragment is ready to be interacted with.
|
void |
onSaveInstanceState(android.os.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(android.view.View view,
android.os.Bundle savedInstanceState)
Called when the fragment view hierarchy is created.
|
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, hashCode, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isRemoving, isResumed, isVisible, onActivityCreated, onActivityResult, onAttach, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreate, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onDetach, onHiddenChanged, onInflate, onInflate, onInflate, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPictureInPictureModeChanged, onPrepareOptionsMenu, onRequestPermissionsResult, onTrimMemory, onViewStateRestored, 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, toString, unregisterForContextMenu
public static MapFragment newInstance()
public static MapFragment newInstance(MapboxMapOptions mapboxMapOptions)
mapboxMapOptions
- The configuration options to be used.public android.view.View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
onCreateView
in class android.app.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(android.view.View view, android.os.Bundle savedInstanceState)
onViewCreated
in class android.app.Fragment
view
- The content view of the fragmentsavedInstanceState
- THe saved instance state of the framgntpublic void onStart()
onStart
in class android.app.Fragment
public void onResume()
onResume
in class android.app.Fragment
public void onPause()
onPause
in class android.app.Fragment
public void onSaveInstanceState(android.os.Bundle outState)
onSaveInstanceState
in class android.app.Fragment
outState
- The saved statepublic void onStop()
onStop
in class android.app.Fragment
public void onLowMemory()
onLowMemory
in interface android.content.ComponentCallbacks
onLowMemory
in class android.app.Fragment
public void onDestroyView()
onDestroyView
in class android.app.Fragment
public void getMapAsync(OnMapReadyCallback onMapReadyCallback)
onMapReadyCallback
- The callback to be invoked.