Differences Between Mapview, Mapframent And Supportmapfragment
Solution 1:
MapView:
A View which displays a map (with data obtained from the Google Maps service). When focused, it will capture key-presses and touch gestures to move the map.
Users of this class must forward all the life cycle methods from the Activity or Fragment containing this view to the corresponding ones in this class.
Use it if you are going to add a
mapinto afragment. (you need to update each lifecycle to MapView).
See Google API Documentation
MapFragment:
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.
Use it if you want to add a
mapintoActivityclass (not fragment because it will create a nested fragment and it´s a mess).
See Google API Documentation.
SupportMapFragment:
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
Use
SupportMapFragmentif you are targeting Android API levels below 12.
See Google API Documentation.
Post a Comment for "Differences Between Mapview, Mapframent And Supportmapfragment"