public class MapFragment
extends android.app.Fragment
<fragment
class="uk.co.ordnancesurvey.android.maps.MapFragment"
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 MapFragment'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.
Use this class only if you are targeting API 11 and above. Otherwise, use SupportMapFragment.
Modifier and Type | Field and Description |
---|---|
uk.co.ordnancesurvey.android.maps.MapView |
mMapView |
OSMapOptions |
mOptions |
Constructor and Description |
---|
MapFragment() |
MapFragment(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 MapFragment |
newInstance()
Creates a map fragment, using default options.
|
static MapFragment |
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, getLoaderManager, getParentFragment, getResources, getRetainInstance, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, hashCode, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isRemoving, isResumed, isVisible, onActivityCreated, onActivityResult, onAttach, onConfigurationChanged, onContextItemSelected, onCreate, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onDetach, onHiddenChanged, onInflate, onInflate, onLowMemory, onOptionsItemSelected, onOptionsMenuClosed, onPrepareOptionsMenu, onSaveInstanceState, onStart, onStop, onTrimMemory, onViewCreated, onViewStateRestored, registerForContextMenu, setArguments, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setRetainInstance, setTargetFragment, setUserVisibleHint, startActivity, startActivity, startActivityForResult, startActivityForResult, toString, unregisterForContextMenu
public final OSMapOptions mOptions
public uk.co.ordnancesurvey.android.maps.MapView mMapView
public MapFragment()
public MapFragment(OSMapOptions options)
public android.view.View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
onCreateView
in class android.app.Fragment
public OSMap getMap()
OSMap
that is tied to the view wrapped by this fragment.
public void onResume()
onResume
in class android.app.Fragment
public void onPause()
onPause
in class android.app.Fragment
public void onDestroyView()
onDestroyView
in class android.app.Fragment
public static MapFragment newInstance()
public static MapFragment newInstance(OSMapOptions options)
Copyright © 2012–2013 Ordnance Survey. All rights reserved.