Source:
<code>private void setupMapView(final View view, final LatLng oldCenter, final int oldZoom) { final RelativeLayout rlView = (RelativeLayout) view.findViewById(R.id.map_rl); if (mapView != null) { ViewGroup.LayoutParams params = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); mapView.setLayoutParams(params); } final SharedPreferences prefs = getActivity().getSharedPreferences(ListFragment.SHARED_PREFS, 0); rlView.addView(mapView); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(final GoogleMap googleMap) { if (ActivityCompat.checkSelfPermission(MappingFragment.this.getContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED <START> && ActivityCompat.checkSelfPermission(MappingFragment.this.getContext(), <END> android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) { googleMap.setMyLocationEnabled(true); } googleMap.setBuildingsEnabled(true); final boolean showTraffic = prefs.getBoolean(ListFragment.PREF_MAP_TRAFFIC, true); googleMap.setTrafficEnabled(showTraffic); final int mapType = prefs.getInt(ListFragment.PREF_MAP_TYPE, GoogleMap.MAP_TYPE_NORMAL); googleMap.setMapType(mapType); mapRender = new MapRender(getActivity(), googleMap, false); final LatLng centerPoint = getCenter(getActivity(), oldCenter, previousLocation); float zoom = DEFAULT_ZOOM; if (oldZoom >= 0) { zoom = oldZoom; } else { zoom = prefs.getFloat(ListFragment.PREF_PREV_ZOOM, zoom); } final CameraPosition cameraPosition = new CameraPosition.Builder() .target(centerPoint).zoom(zoom).build(); googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); } }); MainActivity.info("done setupMapView."); }</code><technical_language>&& needs ||</technical_language>

Target:
private void setupMapView(final View view, final LatLng oldCenter, final int oldZoom) { final RelativeLayout rlView = (RelativeLayout) view.findViewById(R.id.map_rl); if (mapView != null) { ViewGroup.LayoutParams params = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); mapView.setLayoutParams(params); } final SharedPreferences prefs = getActivity().getSharedPreferences(ListFragment.SHARED_PREFS, 0); rlView.addView(mapView); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(final GoogleMap googleMap) { if (ActivityCompat.checkSelfPermission(MappingFragment.this.getContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(MappingFragment.this.getContext(), android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) { googleMap.setMyLocationEnabled(true); } googleMap.setBuildingsEnabled(true); final boolean showTraffic = prefs.getBoolean(ListFragment.PREF_MAP_TRAFFIC, true); googleMap.setTrafficEnabled(showTraffic); final int mapType = prefs.getInt(ListFragment.PREF_MAP_TYPE, GoogleMap.MAP_TYPE_NORMAL); googleMap.setMapType(mapType); mapRender = new MapRender(getActivity(), googleMap, false); final LatLng centerPoint = getCenter(getActivity(), oldCenter, previousLocation); float zoom = DEFAULT_ZOOM; if (oldZoom >= 0) { zoom = oldZoom; } else { zoom = prefs.getFloat(ListFragment.PREF_PREV_ZOOM, zoom); } final CameraPosition cameraPosition = new CameraPosition.Builder() .target(centerPoint).zoom(zoom).build(); googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); } }); MainActivity.info("done setupMapView."); }