/**
   * Get a new instance of the dialog fragment with an image in it
   *
   * @param arg argument for the bundle
   * @param bmp {@link Bitmap} image to be put in the dialog
   * @param activity {@link Activity} get the parent activity
   * @return the fragment to be shown
   */
  public static ImageDialogFragment newInstance(int arg, Bitmap bmp, Activity activity) {
    frag = new ImageDialogFragment();
    Bundle args = new Bundle();
    args.putInt("count", arg);
    frag.setArguments(args);

    // Get width and height of device
    act = activity;
    displaymetrics = new DisplayMetrics();
    frag.setBitmap(bmp);
    fullScreen();
    return frag;
  }
  /** Method that scales the image as wide or as high as the display */
  private static void fullScreen() {
    act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
    displayHeight = displaymetrics.heightPixels;
    displayWidth = displaymetrics.widthPixels;

    // Get width and height of image
    int bmpWidth = mBitmap.getWidth();
    int bmpHeight = mBitmap.getHeight();

    // Resize the image to full screen
    Bitmap bitmap;
    if (bmpHeight > displayHeight || displayHeight < displayWidth) {
      bitmap =
          Bitmap.createScaledBitmap(
              mBitmap, displayHeight * bmpWidth / bmpHeight, displayHeight, false);
    } else {
      bitmap =
          Bitmap.createScaledBitmap(
              mBitmap, displayWidth, displayWidth * bmpHeight / bmpWidth, false);
    }

    frag.setBitmap(bitmap);
  }