public class SupportMapFragment
extends android.support.v4.app.Fragment
<fragment
class="uk.co.ordnancesurvey.android.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
An OSMap
can only be acquired using getMap()
when the underlying maps system is loaded and the underlying
view in the fragment exists. This class automatically initializes the maps system and the view. If an OSMap
is not available, getMap()
will return null.
A view can be removed when the SupportMapFragment's onDestroyView()
method is called. When this happens the MapFragment
is no longer valid until the view is recreated again later when MapFragment's onCreateView(LayoutInflater, ViewGroup, Bundle)
method is called.
Any objects obtained from the OSMap
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.
To use this class, you must include the Android support library in your build path.
Modifier and Type | Field and Description |
---|---|
OSMapOptions |
mOptions |
Constructor and Description |
---|
SupportMapFragment() |
SupportMapFragment(OSMapOptions options) |
Modifier and Type | Method and Description |
---|---|
OSMap |
getMap()
Gets the underlying
OSMap that is tied to the view wrapped by this fragment. |
static SupportMapFragment |
newInstance()
Creates a map fragment, using default options.
|
static SupportMapFragment |
newInstance(OSMapOptions options)
Creates a map fragment with the given options
|
android.view.View |
onCreateView(android.view.LayoutInflater inflater,
android.view.ViewGroup container,
android.os.Bundle savedInstanceState) |
void |
onDestroyView() |
void |
onPause() |
void |
onResume() |
dump, equals, getActivity, getArguments, getChildFragmentManager, getFragmentManager, getId, getLayoutInflater, getLoaderManager, getParentFragment, getResources, getRetainInstance, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, hashCode, hasOptionsMenu, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isVisible, onActivityCreated, onActivityResult, onAttach, onConfigurationChanged, onContextItemSelected, onCreate, onCreateAnimation, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onDetach, onHiddenChanged, onInflate, onLowMemory, onOptionsItemSelected, onOptionsMenuClosed, onPrepareOptionsMenu, onSaveInstanceState, onStart, onStop, onViewCreated, onViewStateRestored, registerForContextMenu, setArguments, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setRetainInstance, setTargetFragment, setUserVisibleHint, startActivity, startActivityForResult, toString, unregisterForContextMenu
public final OSMapOptions mOptions
public SupportMapFragment()
public SupportMapFragment(OSMapOptions options)
public android.view.View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
onCreateView
in class android.support.v4.app.Fragment
public OSMap getMap()
OSMap
that is tied to the view wrapped by this fragment.public void onResume()
onResume
in class android.support.v4.app.Fragment
public void onPause()
onPause
in class android.support.v4.app.Fragment
public void onDestroyView()
onDestroyView
in class android.support.v4.app.Fragment
public static SupportMapFragment newInstance()
public static SupportMapFragment newInstance(OSMapOptions options)
Copyright © 2012–2013 Ordnance Survey. All rights reserved.