code: private static File createTempFile(File storageDir) throws IOException {
          // Create an image file name
          String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US).format(new Date());
          String imageFileName = "JPEG_" + timeStamp + "_";
          if(!storageDir.mkdir() && !storageDir.exists()){
              throw new IOException("Unable to create temporary media directory");
          }
  
          return File.createTempFile(
                  imageFileName,  /* prefix */
                  ".jpg",         /* suffix */
                  storageDir      /* directory */
          );
      }
docs: Create a temporary file to use to handle selected images from the picker
  
  @return  the temporary file in the given storage directory
  
  @throws IOException