public static boolean showInstance(
      final MapContextMenu menu, final MainActivity mainActivity, final boolean centered) {
    try {

      if (menu.getLatLon() == null) {
        return false;
      }

      int slideInAnim = R.anim.slide_in_bottom;
      int slideOutAnim = R.anim.slide_out_bottom;

      if (menu.isExtended()) {
        slideInAnim = menu.getSlideInAnimation();
        slideOutAnim = menu.getSlideOutAnimation();
      }

      MapContextMenuFragment fragment = new MapContextMenuFragment();
      fragment.centered = centered;
      mainActivity
          .getSupportFragmentManager()
          .beginTransaction()
          .setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
          .add(R.id.fragmentContainer, fragment, TAG)
          .addToBackStack(TAG)
          .commitAllowingStateLoss();

      return true;

    } catch (RuntimeException e) {
      return false;
    }
  }
  public static void showInstance(final MapActivity mapActivity) {

    int slideInAnim = R.anim.slide_in_bottom;
    int slideOutAnim = R.anim.slide_out_bottom;

    MapContextMenu menu = mapActivity.getContextMenu();
    if (menu.isExtended()) {
      slideInAnim = menu.getSlideInAnimation();
      slideOutAnim = menu.getSlideOutAnimation();
    }

    MapContextMenuFragment fragment = new MapContextMenuFragment();
    mapActivity
        .getSupportFragmentManager()
        .beginTransaction()
        .setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
        .add(R.id.fragmentContainer, fragment, TAG)
        .addToBackStack(TAG)
        .commit();
  }