Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps Android API: SupportMapFragment vs MapFragment

I read through the google maps API documentation and under MapFragment, it advises to use the class only when targeting API 12 and above. Then I assume that SupportMapFragment targets API 11 and below, though google didn't explicit mention it in the documentation. Then what if I want to target a wide range of API lvl? Does SupportMapFragment also targets API above 11?

like image 457
user2168777 Avatar asked Mar 14 '13 08:03

user2168777


People also ask

What is SupportMapFragment in Android Studio?

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.

What is OnMapReadyCallback?

public interface OnMapReadyCallback. Callback interface for when the map is ready to be used. Once an instance of this interface is set on a MapFragment or MapView object, the onMapReady(GoogleMap) method is triggered when the map is ready to be used and provides a non-null instance of GoogleMap .

What is mapfragment in Android Studio?

public class MapFragment extends Fragment. 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.

What is a fragment in Google Maps?

Google is committed to advancing racial equity for Black communities. See how. 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.

What is supportmapfragment in Java?

public class SupportMapFragment extends Fragment 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.

When is a mapfragment no longer valid?

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.


1 Answers

Then I assume that SupportMapFragment targets API 11 and below, though google didn't explicit mention it in the documentation.

SupportMapFragment is for use with the Android Support package's backport of fragments. It can be used on Android devices running API 10 and lower, as well as Android devices running 11 and higher. MapFragment requires the native API Level 11 fragment implementation, and therefore can only be used on API Level 11 and higher devices.

Note that there are no devices running API Level 11 that I know of -- everything has been upgraded at least to API Level 12.

like image 116
CommonsWare Avatar answered Oct 14 '22 12:10

CommonsWare