Code example for Camera

Methods: setOneShotPreviewCallback

  public synchronized void requestPreviewFrame(Handler handler, int message) {
    Camera theCamera = camera;
    if (theCamera != null && previewing) {
      previewCallback.setHandler(handler, message);
   * Calculates the framing rect which the UI should draw to show the user where to place the 
   * barcode. This target helps with alignment as well as forces the user to hold the device 
   * far enough away to ensure the image will be in focus. 
   * @return The rectangle to draw on screen in window coordinates. 
  public synchronized Rect getFramingRect() {
    if (framingRect == null) {
      if (camera == null) {
        return null;