Web Demos

BARCODE READER SDK DEMO

Explore the flexibe barcode reading settings to optimize for your specific usage scenario.

WEB TWAIN SDK DEMO

Try the most popular web scanner features: scan images, import local images and PDF files, edit, save to local, upload to database, and etc.

BARCODE READER JAVASCRIPT DEMO

Transform any camera-equipped devices into real-time, browser-based barcode and QR code scanners.

MRZ SCANNER WEB DEMO

Detects the machine-readable zone of a passport, scans the text, and parses into human-readable data.

APP STORE DEMOS

BARCODE READER SDK FOR IOS

BARCODE READER SDK FOR ANDROID

VIEW MORE DEMOS >
Resource Base
Table of contents

DCECameraView

The camera view is the main UI view of the DCE SDK. It is designed to display the video preview, overlay, viewfinder, etc.

class com.dynamsoft.dce.DCECameraView extends RelativeLayout
Method Name Description
DCECameraView Initialize the DCECameraView object.
setOverlayVisible This method controls whether the camera view to display coloured and translucent overlay.
getOverlayVisible Get the visibility (true: visible/ false: invisible) of the overlay.
setOverlayColour Set the stroke and fill colour of the overlay.
setViewfinderVisible This method controls whether to display a viewfinder.
getViewfinderVisible Get the visibility (true: visible/ false: invisible) of the viewfinder.
setViewfinder Set the position and the size of the viewfinder.
setTorchButton Set the position of the torch button. The visibility of the torch button will be set to true as well.
setTorchButtonVisible Set the visibility of the torch button. The torch button icon is pre-set in the SDK.
getTorchButtonVisible Get the visibility setting of the torch button. When it returns true, a torch button should be displayed on the screen.

 

DCECameraView

Initialize the DCECameraView object.

DCECameraView(android.content.Context context)

Parameters

context: An instance of global information about an application environment.

 

setOverlayVisible

This method controls whether the camera view displays coloured and translucent overlays.

void setOverlayVisible(boolean overlayVisibile)

Parameters

overlayVisibile: If true, the camera view will draw and display overlays according to the position and colour settings. Otherwise, the overlay will be hidden.

Code Snippet

//Suppose dceCameraView is an object of `DCECameraView`
dceCameraView.setOverlayVisible(true);

 

getOverlayVisible

Get the visibility (true: visible/ false: invisible) of the overlay.

boolean getOverlayVisible()

Return Value

The visibility (true: visible/ false: invisible) of the overlay.

Code Snippet

//Suppose dceCameraView is an object of `DCECameraView`
boolean isVisible = dceCameraView.getOverlayVisible();

 

setOverlayColour

Set the stroke and fill colour of the overlays.

void setOverlayColour(int strokeARGB, int fillARGB)

Parameters

strokeARGB: The colour code of the overlays stroke. fillARGB: The colour code of the overlays stroke.

Code Snippet

//Suppose dceCameraView is an object of `DCECameraView`
dceCameraView.setOverlayColour(0xff00ff00, 0x00000000);

 

setViewfinderVisible

This method controls whether to display a viewfinder.

void setViewfinderVisible(boolean viewfinderVisible)

Parameters

viewfinderVisible: A boolean value that means whether the viewfinder is visible or not. Users can define the position and size of the viewfinder via method setViewfinder. The viewfinder will be created based on the default value if the setViewfinder has never been triggered.

Code Snippet

//Suppose dceCameraView is an object of `DCECameraView`
dceCameraView.setViewfinderVisible(true);

 

getViewfinderVisible

Get the visibility (true: visible/ false: invisible) of the viewfinder.

Return Value

A boolean value means whether the viewfinder is visible.

Code Snippet

//Suppose dceCameraView is an object of `DCECameraView`
boolean flag = dceCameraView.getViewfinderVisible();

 

setViewfinder

Set the position and the size of the viewfinder.

void setViewfinder(float left, float top, float right, float bottom) throws CameraEnhancerException

Parameters

left: The distance (by percentage) between the left border of the viewfinder and the left side of the screen. The default value is 0.15.
top: The distance (by percentage) between the top border of the viewfinder and the top side of the screen. The default value is 0.3.
right: The distance (by percentage) between the right border of the viewfinder and the left side of the screen. The default value is 0.85.
bottom: The distance (by percentage) between the bottom border of the viewfinder and the top side of the screen. The default value is 0.7.

Code Snippet

//Suppose dceCameraView is an object of `DCECameraView`
dceCameraView.setViewfinder(0.2, 0.3, 0.8, 0.7);

Remarks

The viewfinder is built based on the screen coordinate system. The origin of the coordinate is the left-top point of the mobile device. The left border of the viewfinder always means the closest border that parallels to the left side of the mobile device no matter how the mobile device is rotated.

 

setTorchButton

Set the position of the torch button. The visibility of the torch button will be set to true as well.

void setTorchButton(Point torchButtonPosition)

Parameters

torchButtonPosition: The torchButtonPosition illustrates the coordinates of the torch button on the camera view. The x coordinate of the point stands for the pixel distance between the point and the left edge of the screen. The y coordinate of the point stands for the pixel distance between the point and the top edge of the screen.

setScanRegion

torchButtonPosition is the position on the camera view

Code Snippet

Point torchButtonPosition = new Point();
torchButtonPosition.x = 100;
torchButtonPosition.y = 100;
dceCameraView.setTorchButtonPosition(torchButtonPosition);

 

setTorchButtonVisible

Set the visibility of the torch button. The torch button icon is preset in the SDK. If the torchButtonPosition has never been configured, the torchButton will be displayed on the default position. Currently, the icon and the size of the button are not available for setting.

void setTorchButtonVisible(boolean isTorchButtonVisible)

Parameters

isTorchButtonVisible: When the value is true, the torch button should be displayed. Otherwise, the torch button should be hidden.

Code Snippet

dceCameraView.setTorchButtonVisible(true);

 

getTorchButtonVisible

Get the visibility setting of the torch button. When it returns true, a torch button should be displayed on the screen.

Boolean getTorchButtonVisible()

Return Value

A boolean value. When the value is true, the torch button should be displayed. Otherwise, the torch button should be hidden.

Code Snippet

Boolean isTorchButtonVisible = dceCameraView.getTorchButtonVisible();

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

version 2.1.0

  • Latest version
  • Version 2.3.2
  • Version 2.3.1
  • Version 2.1.0
  • Version 2.0.0
  • Version 1.0.3
  • Version 1.0.1
  • Version 1.0.0
Change +
© 2003–2022 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support