Source:
public void onActivityCreated(final Bundle savedState) { super.onActivityCreated(savedState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { adjustToWindowsInsets(); } App.components().inject(this); osmNoticeOverlay.setMovementMethod(LinkMovementMethod.getInstance()); mapView = MapViewUtils.createMapView(getActivity()); mapContainer.addView(mapView); zoomToLocation(defaultGeoPoint, DEFAULT_ZOOM_LEVEL); oberserverInfowWindow = MapViewUtils.createObserverInfoWindow(mapView); setCurrentLocationCenter.setOnClickListener(centerLocationOnClickListener); setRotationNorth.setOnClickListener(rotationNorthOnClickListener); noDataConnectivityButton.setOnClickListener(v -> AlertBuilder.show(getActivity(), R.string.map_no_internet_connection_title, R.string.map_no_internet_connection_text)); if (new BooleanPreference(sharedPreferences, SharedPrefsKeys.DISABLE_MAP_ROTATION).get()) { setRotationNorth.setVisibility(View.GONE); } else { RotationGestureOverlay rotationGestureOverlay = new RotationGestureOverlay(mapView) { @Override public void onRotate(float deltaAngle) { super.onRotate(deltaAngle); setRotationNorth.setRotation(mapView.getMapOrientation()); } }; rotationGestureOverlay.setEnabled(true); mapView.setMultiTouchControls(true); mapView.getOverlays().add(rotationGestureOverlay); } if (savedState != null) { Double zoomLevel = (Double) savedState.get(KEY_MAP_ZOOMLEVEL); GeoPoint position = savedState.getParcelable(KEY_MAP_POSITION); Float orientation = (Float) savedState.get(KEY_MAP_ORIENTATION); if (zoomLevel != null && position != null && orientation != null) { mapView.getController().setZoom(zoomLevel); if (!new BooleanPreference(sharedPreferences, SharedPrefsKeys.DISABLE_MAP_ROTATION) .get()) { mapView.setMapOrientation(orientation); } setToLocation(position); } isInitialLocationSet = savedState.getBoolean(KEY_INITIAL_LOCATION_SET, false); } setRotationNorth.setRotation(mapView.getMapOrientation()); }

Target:
public void onActivityCreated(final Bundle savedState) { super.onActivityCreated(savedState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { adjustToWindowsInsets(); } App.components().inject(this); osmNoticeOverlay.setMovementMethod(LinkMovementMethod.getInstance()); mapView = MapViewUtils.createMapView(getActivity()); mapContainer.addView(mapView); oberserverInfowWindow = MapViewUtils.createObserverInfoWindow(mapView); setCurrentLocationCenter.setOnClickListener(centerLocationOnClickListener); setRotationNorth.setOnClickListener(rotationNorthOnClickListener); noDataConnectivityButton.setOnClickListener(v -> AlertBuilder.show(getActivity(), R.string.map_no_internet_connection_title, R.string.map_no_internet_connection_text)); if (new BooleanPreference(sharedPreferences, SharedPrefsKeys.DISABLE_MAP_ROTATION).get()) { setRotationNorth.setVisibility(View.GONE); } else { RotationGestureOverlay rotationGestureOverlay = new RotationGestureOverlay(mapView) { @Override public void onRotate(float deltaAngle) { super.onRotate(deltaAngle); setRotationNorth.setRotation(mapView.getMapOrientation()); } }; rotationGestureOverlay.setEnabled(true); mapView.setMultiTouchControls(true); mapView.getOverlays().add(rotationGestureOverlay); } if (savedState != null) { Double zoomLevel = (Double) savedState.get(KEY_MAP_ZOOMLEVEL); GeoPoint position = savedState.getParcelable(KEY_MAP_POSITION); Float orientation = (Float) savedState.get(KEY_MAP_ORIENTATION); if (zoomLevel != null && position != null && orientation != null) { mapView.getController().setZoom(zoomLevel); if (!new BooleanPreference(sharedPreferences, SharedPrefsKeys.DISABLE_MAP_ROTATION) .get()) { mapView.setMapOrientation(orientation); } setToLocation(position); } isInitialLocationSet = savedState.getBoolean(KEY_INITIAL_LOCATION_SET, false); } setRotationNorth.setRotation(mapView.getMapOrientation()); }