@Override
  public void onStop() {
    super.onStop();
    mPaused = true;

    // mGetter could be null if we call finish() and leave early in
    // onStart().
    if (mGetter != null) {
      mGetter.cancelCurrent();
      mGetter.stop();
      mGetter = null;
    }
    setMode(MODE_NORMAL);

    // removing all callback in the message queue
    mHandler.removeAllGetterCallbacks();

    if (mAllImages != null) {
      mSavedUri = getCurrentUri();
      mAllImages.close();
      mAllImages = null;
    }

    hideOnScreenControls();
    mImageView.clear();
    mCache.clear();

    for (ImageViewTouchBase iv : mSlideShowImageViews) {
      iv.clear();
    }
  }
 @Override
 protected void onDestroy() {
   if (mAllImages != null) {
     mAllImages.close();
   }
   super.onDestroy();
 }