public void init() {
    camera = ((FtcRobotControllerActivity) context).camera;

    camera.setPreviewCallback(previewCallback);

    Camera.Parameters parameters = camera.getParameters();

    data = parameters.flatten();

    ((FtcRobotControllerActivity) context).initPreviewLinear(camera, this, previewCallback);
  }