code: public void cancelShareLinkDialog(boolean animateClose) {
          if (shareDlg_ != null && shareDlg_.isShowing()) {
              if (animateClose) {
                  // Cancel the dialog with animation
                  shareDlg_.cancel();
              } else {
                  // Dismiss the dialog immediately
                  shareDlg_.dismiss();
              }
          }
      }
docs: Dismiss the share dialog if showing. Should be called on activity stopping.
  
  @param animateClose A {@link Boolean} to specify whether to close the dialog with an animation.
  A value of true will close the dialog with an animation. Setting this value
  to false will close the Dialog immediately.