1

I have updated play services from 9.0.1 to 15.0.0, now i am seeing that MapView.getMap(); is no longer supported.

I checked this, I followed it and fixed the problem.

public class MapsFragment extends Fragment implements OnMapReadyCallback{

MapView mMapView;

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

  mMapView = (MapView) view.findViewById(R.id.mapView);
  mMapView.onCreate(savedInstanceState);
  mMapView.getMapAsync(this);

}   

@Override
public void onMapReady(GoogleMap googleMap) {

}

Layout

<com.google.android.gms.maps.MapView
    android:id="@+id/mapView"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

The issue is, I am using MapView and not GoogleMap, so i have just added onMapReady() method as its required by interface, but i am not doing anything in it.

Everything sees to be working fine, but should i change MapView to GoogleMap, or its fine, if i keep using MapView in play-services:15.0.0

MrUpsidown
  • 21,592
  • 15
  • 77
  • 131
dev90
  • 7,187
  • 15
  • 80
  • 153

1 Answers1

1

There is no need (and it's impossible) to replace MapView by GoogleMap because it's completely different: MapView FrameLayout - based view which displays a map and GoogleMap is the entry point for all methods related to the map. So its fine keep using MapView.

Andrii Omelchenko
  • 13,183
  • 12
  • 43
  • 79