private void setCameraParameters() {
    Camera.Parameters parameters = camera.getParameters();
    Camera.Size size = parameters.getPreviewSize();
    Log.v(TAG, "Default preview size: " + size.width + ", " + size.height);
    previewFormat = parameters.getPreviewFormat();
    previewFormatString = parameters.get("preview-format");
    Log.v(TAG, "Default preview format: " + previewFormat + '/' + previewFormatString);

    cameraResolution = new Point();
    cameraResolution.x = (screenResolution.x >> 3) << 3;
    cameraResolution.y = (screenResolution.y >> 3) << 3;
    Log.v(TAG, "Setting preview size: " + cameraResolution.x + ", " + cameraResolution.y);
    parameters.setPreviewSize(cameraResolution.x, cameraResolution.y);

    // FIXME: This is a hack to turn the flash off on the Samsung Galaxy.
    parameters.set("flash-value", 2);

    // This is the standard setting to turn the flash off that all devices should honor.
    parameters.set("flash-mode", "off");

    // Set zoom to 2x if available. This helps encourage the user to pull back.
    // Some devices like the Behold have a zoom parameter
    parameters.set("zoom", "2.0");
    // Most devices, like the Hero, appear to expose this zoom parameter.
    // (I think) This means 2.0x
    parameters.set("taking-picture-zoom", "20");

    camera.setParameters(parameters);
  }

  private Point getScreenResolution() {
    if (screenResolution == null) {
      WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
      Display display = manager.getDefaultDisplay();
      screenResolution = new Point(display.getWidth(), display.getHeight());
    }
    return screenResolution;
  }