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 file simply with the XML below.
<fragment class="com.google.android.gms.maps.MapFragment" android:layout_width="match_parent" android:layout_height="match_parent"/>
A
GoogleMap
must be acquired using
getMapAsync(OnMapReadyCallback)
. This class automatically initializes the maps system and the view.
A view can be removed when the MapFragment's onDestroyView()
method is called and the GoogleMapOptions.useViewLifecycleInFragment(boolean)
option is set. When this happens the MapFragment is no longer valid until the view is recreated again later when the MapFragment's onCreateView(LayoutInflater, ViewGroup, Bundle)
method is called.
Any objects obtained from the GoogleMap
are associated with the view. It's important to not hold on to objects (e.g. Marker
) beyond the view's life. Otherwise it will cause a memory leak as the view cannot be released.
Use this class only if you are targeting API 12 and above. Otherwise, use SupportMapFragment by adding the Android support library to your build path.
Developer GuideFor more information, read the Google Maps SDK for Android developer guide.
Inherited Constant Summary From interface android.content.ComponentCallbacks2 int TRIM_MEMORY_BACKGROUND int TRIM_MEMORY_COMPLETE int TRIM_MEMORY_MODERATE int TRIM_MEMORY_RUNNING_CRITICAL int TRIM_MEMORY_RUNNING_LOW int TRIM_MEMORY_RUNNING_MODERATE int TRIM_MEMORY_UI_HIDDEN Public Constructor Summary Public Method Summary Inherited Method Summary From class android.app.Fragment void final boolean final ActivitygetActivity()
booleangetAllowEnterTransitionOverlap()
booleangetAllowReturnTransitionOverlap()
final BundlegetArguments()
final FragmentManagergetChildFragmentManager()
ContextgetContext()
TransitiongetEnterTransition()
TransitiongetExitTransition()
final FragmentManagergetFragmentManager()
final ObjectgetHost()
final intgetId()
final LayoutInflatergetLayoutInflater()
LoaderManagergetLoaderManager()
final FragmentgetParentFragment()
TransitiongetReenterTransition()
final ResourcesgetResources()
final booleangetRetainInstance()
TransitiongetReturnTransition()
TransitiongetSharedElementEnterTransition()
TransitiongetSharedElementReturnTransition()
final String final StringgetString(int arg0)
final StringgetTag()
final FragmentgetTargetFragment()
final intgetTargetRequestCode()
final CharSequencegetText(int arg0)
booleangetUserVisibleHint()
ViewgetView()
final inthashCode()
static Fragment static Fragment final booleanisAdded()
final booleanisDetached()
final booleanisHidden()
final booleanisInLayout()
final booleanisRemoving()
final booleanisResumed()
final booleanisStateSaved()
final booleanisVisible()
void onActivityCreated(
Bundlearg0)
void onActivityResult(int arg0, int arg1,
Intentarg2)
void void void void boolean void AnimatoronCreateAnimator(int arg0, boolean arg1, int arg2)
void void View voidonDestroy()
voidonDestroyOptionsMenu()
voidonDestroyView()
voidonDetach()
LayoutInflater onGetLayoutInflater(
Bundlearg0)
voidonHiddenChanged(boolean arg0)
void void void voidonLowMemory()
voidonMultiWindowModeChanged(boolean arg0)
void boolean void onOptionsMenuClosed(
Menuarg0)
voidonPause()
void voidonPictureInPictureModeChanged(boolean arg0)
void onPrepareOptionsMenu(
Menuarg0)
void onRequestPermissionsResult(int arg0,
String[]arg1, int[] arg2)
voidonResume()
void onSaveInstanceState(
Bundlearg0)
voidonStart()
voidonStop()
voidonTrimMemory(int arg0)
void void onViewStateRestored(
Bundlearg0)
voidpostponeEnterTransition()
void registerForContextMenu(
Viewarg0)
final void requestPermissions(
String[]arg0, int arg1)
voidsetAllowEnterTransitionOverlap(boolean arg0)
voidsetAllowReturnTransitionOverlap(boolean arg0)
void void void void void voidsetHasOptionsMenu(boolean arg0)
void voidsetMenuVisibility(boolean arg0)
void voidsetRetainInstance(boolean arg0)
void void setSharedElementEnterTransition(
Transitionarg0)
void setSharedElementReturnTransition(
Transitionarg0)
void setTargetFragment(
Fragmentarg0, int arg1)
voidsetUserVisibleHint(boolean arg0)
boolean shouldShowRequestPermissionRationale(
Stringarg0)
void void void startActivityForResult(
Intentarg0, int arg1)
void startActivityForResult(
Intentarg0, int arg1,
Bundlearg2)
void voidstartPostponedEnterTransition()
StringtoString()
void unregisterForContextMenu(
Viewarg0)
From class java.lang.Object Objectclone()
boolean voidfinalize()
final Class<?>getClass()
inthashCode()
final voidnotify()
final voidnotifyAll()
StringtoString()
final voidwait(long arg0, int arg1)
final voidwait(long arg0)
final voidwait()
From interface android.content.ComponentCallbacks2 abstract voidonTrimMemory(int arg0)
From interface android.view.View.OnCreateContextMenuListener From interface android.content.ComponentCallbacks abstract void abstract voidonLowMemory()
Public Constructors public MapFragment ()Creates a map fragment. This constructor is public only for use by an inflater. Use newInstance()
to create a MapFragment programmatically.
Sets a callback object which will be triggered when the GoogleMap
instance is ready to be used.
Note that:
GoogleMap
object provided by the callback is non-null.null
. public static MapFragment newInstance (GoogleMapOptions options)
Creates a map fragment with the given options.
Parameters options configuration GoogleMapOptions for aGoogleMap
, or null
to use the default options. public static MapFragment newInstance ()
Creates a map fragment, using default options.
public void onActivityCreated (Bundle savedInstanceState) public void onAttach (Activity activity) public void onCreate (Bundle savedInstanceState) public void onDestroyView () public final void onEnterAmbient (Bundle ambientDetails)You must call this method from the parent WearableActivity's corresponding method.
public final void onExitAmbient ()You must call this method from the parent WearableActivity's corresponding method.
public void onInflate (Activity activity, AttributeSet attrs, Bundle savedInstanceState)Parse attributes during inflation from a view hierarchy into the arguments we handle.
public void onLowMemory () public void onSaveInstanceState (Bundle outState)Provides a Bundle
to store the state of the Fragment before it gets destroyed. It can later be retrieved when onCreate(Bundle)
is called again.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4