private static void viewMmsMessageAttachment(
     Context context, Uri msgUri, SlideshowModel slideshow, int requestCode) {
   boolean isSimple = (slideshow == null) ? false : slideshow.isSimple();
   if (isSimple) {
     // In attachment-editor mode, we only ever have one slide.
     MessageUtils.viewSimpleSlideshow(context, slideshow);
   } else {
     // If a slideshow was provided, save it to disk first.
     if (slideshow != null) {
       PduPersister persister = PduPersister.getPduPersister(context);
       try {
         PduBody pb = slideshow.toPduBody();
         persister.updateParts(msgUri, pb);
         slideshow.sync(pb);
       } catch (MmsException e) {
         Log.e(TAG, "Unable to save message for preview");
         return;
       }
     }
     // Launch the slideshow activity to play/view.
     Intent intent = new Intent(context, SlideshowActivity.class);
     intent.setData(msgUri);
     if (requestCode > 0 && context instanceof Activity) {
       ((Activity) context).startActivityForResult(intent, requestCode);
     } else {
       context.startActivity(intent);
     }
   }
 }
  @Override
  protected void onPause() {
    super.onPause();

    synchronized (this) {
      if (mDirty) {
        try {
          PduBody pb = mSlideshowModel.toPduBody();
          PduPersister.getPduPersister(this).updateParts(mUri, pb);
          mSlideshowModel.sync(pb);
        } catch (MmsException e) {
          Log.e(TAG, "Cannot update the message: " + mUri, e);
        }
      }
    }
  }