diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/DestinationReachedMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/DestinationReachedMenu.java index c56dda3e6f..a6034e2c0f 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/DestinationReachedMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/DestinationReachedMenu.java @@ -12,8 +12,7 @@ public class DestinationReachedMenu extends BaseMenuController { } public static void show(MapActivity mapActivity) { - Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag(DestinationReachedMenuFragment.TAG); - if (fragment == null || fragment.isDetached()) { + if (!DestinationReachedMenuFragment.isExists()) { DestinationReachedMenu menu = new DestinationReachedMenu(mapActivity); DestinationReachedMenuFragment.showInstance(menu); } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/DestinationReachedMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/DestinationReachedMenuFragment.java index 3caedf6ccf..e92b72f047 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/DestinationReachedMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/DestinationReachedMenuFragment.java @@ -27,8 +27,14 @@ import net.osmand.plus.poi.PoiUIFilter; public class DestinationReachedMenuFragment extends Fragment { public static final String TAG = "DestinationReachedMenuFragment"; + private static boolean exists = false; private DestinationReachedMenu menu; + + public DestinationReachedMenuFragment() { + exists = true; + } + @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -153,6 +159,15 @@ public class DestinationReachedMenuFragment extends Fragment { getMapActivity().getContextMenu().setBaseFragmentVisibility(true); } + @Override + public void onDestroy() { + super.onDestroy(); + exists = false; + } + + public static boolean isExists() { + return exists; + } public static void showInstance(DestinationReachedMenu menu) { int slideInAnim = menu.getSlideInAnimation();