Class MapFragment

java.lang.Object
android.app.Fragment
com.trimblemaps.mapsdk.maps.MapFragment
All Implemented Interfaces:
android.content.ComponentCallbacks, android.content.ComponentCallbacks2, android.view.View.OnCreateContextMenuListener, OnMapReadyCallback

public final class MapFragment extends android.app.Fragment implements OnMapReadyCallback
Fragment wrapper around a map view.

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

See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Callback to be invoked when the map fragment has inflated its MapView.

    Nested classes/interfaces inherited from class android.app.Fragment

    android.app.Fragment.InstantiationException, android.app.Fragment.SavedState
  • Field Summary

    Fields inherited from interface android.content.ComponentCallbacks2

    TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    getMapAsync(OnMapReadyCallback onMapReadyCallback)
    Sets a callback object which will be triggered when the TrimbleMapsMap instance is ready to be used.
    Creates a default MapFragment instance
    newInstance(TrimbleMapsMapOptions trimbleMapsMapOptions)
    Creates a MapFragment instance
    void
    onAttach(android.content.Context context)
    Called when the context attaches to this fragment.
    android.view.View
    onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
    Creates the fragment view hierarchy.
    void
    Called when the fragment is destroyed.
    void
    Called when the fragment is view hiearchy is being destroyed.
    void
    onInflate(android.content.Context context, android.util.AttributeSet attrs, android.os.Bundle savedInstanceState)
    Called when this fragment is inflated, parses XML tag attributes.
    void
    Called when the fragment receives onLowMemory call from the hosting Activity.
    void
    onMapReady(TrimbleMapsMap trimbleMapsMap)
    Called when the style of the map has successfully loaded.
    void
    Called when the fragment is pausing.
    void
    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
    Called when the fragment is visible for the users.
    void
    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.

    Methods inherited from class android.app.Fragment

    dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, 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, isStateSaved, isVisible, onActivityCreated, onActivityResult, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreate, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroyOptionsMenu, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onInflate, onMultiWindowModeChanged, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPictureInPictureModeChanged, onPictureInPictureModeChanged, onPrepareOptionsMenu, onRequestPermissionsResult, onTrimMemory, 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

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MapFragment

      public MapFragment()
  • Method Details

    • newInstance

      public static MapFragment newInstance()
      Creates a default MapFragment instance
      Returns:
      MapFragment instantiated
    • newInstance

      @NonNull public static MapFragment newInstance(@Nullable TrimbleMapsMapOptions trimbleMapsMapOptions)
      Creates a MapFragment instance
      Parameters:
      trimbleMapsMapOptions - The configuration options to be used.
      Returns:
      MapFragment instantiated.
    • onInflate

      public void onInflate(@NonNull android.content.Context context, android.util.AttributeSet attrs, android.os.Bundle savedInstanceState)
      Called when this fragment is inflated, parses XML tag attributes.
      Overrides:
      onInflate in class android.app.Fragment
      Parameters:
      context - The context inflating this fragment.
      attrs - The XML tag attributes.
      savedInstanceState - The saved instance state for the map fragment.
    • onAttach

      public void onAttach(android.content.Context context)
      Called when the context attaches to this fragment.
      Overrides:
      onAttach in class android.app.Fragment
      Parameters:
      context - the context attaching
    • onCreateView

      public android.view.View onCreateView(@NonNull android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
      Creates the fragment view hierarchy.
      Overrides:
      onCreateView in class android.app.Fragment
      Parameters:
      inflater - Inflater used to inflate content.
      container - The parent layout for the map fragment.
      savedInstanceState - The saved instance state for the map fragment.
      Returns:
      The view created
    • onViewCreated

      public void onViewCreated(android.view.View view, android.os.Bundle savedInstanceState)
      Called when the fragment view hierarchy is created.
      Overrides:
      onViewCreated in class android.app.Fragment
      Parameters:
      view - The content view of the fragment
      savedInstanceState - The saved instance state of the fragment
    • onMapReady

      public void onMapReady(@NonNull TrimbleMapsMap trimbleMapsMap)
      Called when the style of the map has successfully loaded.
      Specified by:
      onMapReady in interface OnMapReadyCallback
      Parameters:
      trimbleMapsMap - The public api controller of the map
    • onStart

      public void onStart()
      Called when the fragment is visible for the users.
      Overrides:
      onStart in class android.app.Fragment
    • onResume

      public void onResume()
      Called when the fragment is ready to be interacted with.
      Overrides:
      onResume in class android.app.Fragment
    • onPause

      public void onPause()
      Called when the fragment is pausing.
      Overrides:
      onPause in class android.app.Fragment
    • onSaveInstanceState

      public void onSaveInstanceState(@NonNull android.os.Bundle outState)
      Called when the fragment state needs to be saved.
      Overrides:
      onSaveInstanceState in class android.app.Fragment
      Parameters:
      outState - The saved state
    • onStop

      public void onStop()
      Called when the fragment is no longer visible for the user.
      Overrides:
      onStop in class android.app.Fragment
    • onLowMemory

      public void onLowMemory()
      Called when the fragment receives onLowMemory call from the hosting Activity.
      Specified by:
      onLowMemory in interface android.content.ComponentCallbacks
      Overrides:
      onLowMemory in class android.app.Fragment
    • onDestroyView

      public void onDestroyView()
      Called when the fragment is view hiearchy is being destroyed.
      Overrides:
      onDestroyView in class android.app.Fragment
    • onDestroy

      public void onDestroy()
      Called when the fragment is destroyed.
      Overrides:
      onDestroy in class android.app.Fragment
    • getMapAsync

      public void getMapAsync(@NonNull OnMapReadyCallback onMapReadyCallback)
      Sets a callback object which will be triggered when the TrimbleMapsMap instance is ready to be used.
      Parameters:
      onMapReadyCallback - The callback to be invoked.