code: @SuppressLint("NewApi")
      public void onDismiss() {
          //remove blurred background and clear memory, could be null if dismissed before blur effect
          //processing ends
          //cancel async task
          if (mBluringTask != null) {
              mBluringTask.cancel(true);
          }
          if (mBlurredBackgroundView != null) {
              if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                  mBlurredBackgroundView
                      .animate()
                      .alpha(0f)
                      .setDuration(mAnimationDuration)
                      .setInterpolator(new AccelerateInterpolator())
                      .setListener(new AnimatorListenerAdapter() {
                          @Override
                          public void onAnimationEnd(Animator animation) {
                              super.onAnimationEnd(animation);
                              removeBlurredView();
                          }
  
                          @Override
                          public void onAnimationCancel(Animator animation) {
                              super.onAnimationCancel(animation);
                              removeBlurredView();
                          }
                      }).start();
              } else {
                  removeBlurredView();
              }
          }
      }
docs: Must be linked to the original lifecycle.