diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index b71a9e5eab..070948a4c5 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -817,7 +817,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven if (Build.VERSION.SDK_INT >= 21) { int colorId = -1; Fragment fragment = getVisibleFragment(getSupportFragmentManager()); - if (fragment != null && fragment.isResumed() && fragment instanceof BaseOsmAndFragment) { + if (fragment != null && !fragment.isRemoving() && fragment instanceof BaseOsmAndFragment) { colorId = ((BaseOsmAndFragment) fragment).getStatusBarColorId(); } else if (dashboardOnMap.isVisible()) { colorId = dashboardOnMap.getStatusBarColor(); diff --git a/OsmAnd/src/net/osmand/plus/base/BaseOsmAndFragment.java b/OsmAnd/src/net/osmand/plus/base/BaseOsmAndFragment.java index 552454f955..db385f9d5c 100644 --- a/OsmAnd/src/net/osmand/plus/base/BaseOsmAndFragment.java +++ b/OsmAnd/src/net/osmand/plus/base/BaseOsmAndFragment.java @@ -58,8 +58,8 @@ public class BaseOsmAndFragment extends Fragment { } @Override - public void onStop() { - super.onStop(); + public void onDetach() { + super.onDetach(); if (Build.VERSION.SDK_INT >= 21 && getStatusBarColorId() != -1) { Activity activity = getActivity(); if (activity instanceof MapActivity) {