Class MapFragment

java.lang.Object
androidx.fragment.app.Fragment
com.naver.maps.map.MapFragment
All Implemented Interfaces:
android.content.ComponentCallbacks, android.view.View.OnCreateContextMenuListener, androidx.activity.result.ActivityResultCaller, androidx.lifecycle.HasDefaultViewModelProviderFactory, androidx.lifecycle.LifecycleOwner, androidx.lifecycle.ViewModelStoreOwner, androidx.savedstate.SavedStateRegistryOwner

@UiThread public class MapFragment extends androidx.fragment.app.Fragment
지도를 출력하는 프래그먼트 클래스. 화면에 이 프래그먼트를 추가하고 getMapAsync(OnMapReadyCallback)를 호출해 콜백을 등록하면 NaverMap 인스턴스를 얻을 수 있습니다.
  • Nested Class Summary

    Nested classes/interfaces inherited from class androidx.fragment.app.Fragment

    androidx.fragment.app.Fragment.InstantiationException, androidx.fragment.app.Fragment.SavedState
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    비동기로 NaverMap 객체를 얻어옵니다.
    이 프래그먼트가 갖고 있는 MapView를 반환합니다.
    새로운 인스턴스를 생성합니다.
    주어진 options를 사용해 새로운 인스턴스를 생성합니다.
    android.view.View
    onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
    void
    void
    onInflate(android.content.Context context, android.util.AttributeSet attrs, android.os.Bundle savedInstanceState)
    void
    void
    void
    void
    onSaveInstanceState(android.os.Bundle outState)
    void
    void
    void
    onViewCreated(android.view.View view, android.os.Bundle savedInstanceState)

    Methods inherited from class androidx.fragment.app.Fragment

    dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getDefaultViewModelProviderFactory, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getParentFragmentManager, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSavedStateRegistry, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hashCode, hasOptionsMenu, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isStateSaved, isVisible, onActivityCreated, onActivityResult, onAttach, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreate, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, onViewStateRestored, postponeEnterTransition, postponeEnterTransition, registerForActivityResult, registerForActivityResult, registerForContextMenu, requestPermissions, requireActivity, requireArguments, requireContext, requireFragmentManager, requireHost, requireParentFragment, requireView, 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

    getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface androidx.lifecycle.HasDefaultViewModelProviderFactory

    getDefaultViewModelCreationExtras
  • Field Details

  • Constructor Details

    • MapFragment

      public MapFragment()
  • Method Details

    • newInstance

      public static MapFragment newInstance()
      새로운 인스턴스를 생성합니다.
      Returns:
      MapFragment 인스턴스.
    • newInstance

      public static MapFragment newInstance(@Nullable NaverMapOptions options)
      주어진 options를 사용해 새로운 인스턴스를 생성합니다.
      Parameters:
      options - 지도 옵션.
      Returns:
      MapFragment 인스턴스.
    • onInflate

      public void onInflate(android.content.Context context, android.util.AttributeSet attrs, android.os.Bundle savedInstanceState)
      Overrides:
      onInflate in class androidx.fragment.app.Fragment
    • onCreateView

      public android.view.View onCreateView(@NonNull android.view.LayoutInflater inflater, @Nullable android.view.ViewGroup container, @Nullable android.os.Bundle savedInstanceState)
      Overrides:
      onCreateView in class androidx.fragment.app.Fragment
    • onViewCreated

      public void onViewCreated(@NonNull android.view.View view, @Nullable android.os.Bundle savedInstanceState)
      Overrides:
      onViewCreated in class androidx.fragment.app.Fragment
    • onStart

      public void onStart()
      Overrides:
      onStart in class androidx.fragment.app.Fragment
    • onResume

      public void onResume()
      Overrides:
      onResume in class androidx.fragment.app.Fragment
    • onPause

      public void onPause()
      Overrides:
      onPause in class androidx.fragment.app.Fragment
    • onSaveInstanceState

      public void onSaveInstanceState(@NonNull android.os.Bundle outState)
      Overrides:
      onSaveInstanceState in class androidx.fragment.app.Fragment
    • onStop

      public void onStop()
      Overrides:
      onStop in class androidx.fragment.app.Fragment
    • onDestroyView

      public void onDestroyView()
      Overrides:
      onDestroyView in class androidx.fragment.app.Fragment
    • onLowMemory

      public void onLowMemory()
      Specified by:
      onLowMemory in interface android.content.ComponentCallbacks
      Overrides:
      onLowMemory in class androidx.fragment.app.Fragment
    • getMapAsync

      public void getMapAsync(@NonNull OnMapReadyCallback callback)
      비동기로 NaverMap 객체를 얻어옵니다. NaverMap 객체가 준비되면 callbackOnMapReadyCallback.onMapReady(NaverMap)가 호출됩니다.
      Parameters:
      callback - 콜백.
    • getMapView

      @Nullable public MapView getMapView()
      이 프래그먼트가 갖고 있는 MapView를 반환합니다. onCreateView()가 호출되기 전, onDestroyView()가 호출된 후에는 null이 반환됩니다.
      Returns:
      MapView 인스턴스.