Inherits RelativeLayout, and BarcodePickerInterface.

Public Member Functions

 BarcodePicker (Context context, ScanSettings settings)
 
void applyScanSettings (ScanSettings settings)
 
void applyScanSettings (ScanSettings settings, Runnable completionCallback)
 
void pauseScanning ()
 
void pauseScanning (Runnable completionCallback)
 
void resumeScanning ()
 
void resumeScanning (Runnable completionCallback)
 
void setOnScanListener (OnScanListener listener)
 
void setPropertyChangeListener (PropertyChangeListener listener)
 
void setAutoFocusOnTapEnabled (boolean enabled)
 
void stopScanning ()
 
void stopScanning (Runnable completionCallback)
 
void startScanning ()
 
void startScanning (boolean startInPausedState)
 
void startScanning (boolean startInPausedState, Runnable completionCallback)
 
void switchTorchOn (boolean on)
 
ScanOverlay getOverlayView ()
 
void setProcessFrameListener (ProcessFrameListener processFrameListener)
 
Point convertPointToPickerCoordinates (Point point)
 
void setPinchToZoomEnabled (boolean enabled)
 

Static Public Member Functions

static boolean canRunPortraitPicker ()
 

Detailed Description

The main interface for scanning barcodes with the Scandit BarcodeScanner SDK.

This class sets up the recognition process, the preview view, controls the camera and provides a callback interface when barcodes are recognized.

The picker class is a able to run in full-screen or as a subview in an existing activity.

Since
4.9.0

Constructor & Destructor Documentation

BarcodePicker ( Context  context,
ScanSettings  settings 
)

Construct a new barcode picker with the given scan settings.

Parameters
contextthe context that the barcode picker belongs to.
settingsthe settings to use.

Member Function Documentation

void applyScanSettings ( ScanSettings  settings)

Reconfigure the barcode picker with new settings.

The settings are applied asynchronously. Once they have been applied, all new frames will be processed with the new settings.

Parameters
settingsthe settings to apply.
void applyScanSettings ( ScanSettings  settings,
Runnable  completionCallback 
)

Reconfigure the barcode picker with new settings.

The settings are applied asynchronously. Once they have been applied, all new frames will be processed with the new settings.

Parameters
settingsthe settings to apply.
completionCallbackrunnable to be executed when the new settings have been applied.
Since
4.15.0
void pauseScanning ( )

Asynchronously pause the scanning process while keeping the camera preview running.

Use this method when you plan to briefly pause the scanning process and intend to resume it later. It is not recommended to use this method when you are interrupting the scanning process for longer periods of time as the camera preview will use considerable power. For such scenarios use stopScanning instead.

Since
4.9.0
void pauseScanning ( Runnable  completionCallback)

Asynchronously pause the scanning process while keeping the camera preview running.

Use this method when you plan to briefly pause the scanning process and intend to resume it later. It is not recommended to use this method when you are interrupting the scanning process for longer periods of time as the camera preview will use considerable power. For such scenarios use stopScanning instead.

Parameters
completionCallbackRunnable to be executed when the scanning has been paused.
Since
4.15.0
void resumeScanning ( )

Asynchronously resume a previously paused scanning process.

Use this method to resume scanning after ScanSession.pauseScanning or pauseScanning was called. Calling resume on a picker that was not previously started with startScanning() is undefined.

Since
4.9.0
void resumeScanning ( Runnable  completionCallback)

Asynchronously resume a previously paused scanning process.

Use this method to resume scanning after ScanSession.pauseScanning or pauseScanning was called. Calling resume on a picker that was not previously started with startScanning() is undefined.

Parameters
completionCallbackRunnable to be executed when the scanning has been resumed.
Since
4.15.0
void setOnScanListener ( OnScanListener  listener)

Set callback to be invoked whenever a new code is recognized.

See also
OnScanListener.didScan
Parameters
listenerthe listener to register. A strong reference is kept to the listener.
void setPropertyChangeListener ( PropertyChangeListener  listener)

Register a listener for scan state change events.

Parameters
listenerthe listener to register. A strong reference is kept to the listener
void setAutoFocusOnTapEnabled ( boolean  enabled)

Enable/disable auto-focus on tap.

By default, a tap on the camera preview causes an auto-focus event. Set this property to false to disable this behavior.

Parameters
enabledWhether to enable/disable auto-focus on tap.
Since
5.1
void stopScanning ( )

Asynchronously stop the scanning process and camera preview.

void stopScanning ( Runnable  completionCallback)

Asynchronously stop the scanning process and camera preview.

Parameters
completionCallbackRunnable to be executed when scanning and preview has been stopped.
Since
4.15.0
void startScanning ( )

Asynchronously start the camera preview and scanning process.

void startScanning ( boolean  startInPausedState)

Asynchronously start the camera preview and scanning process.

Allows to start the camera preview without immediately also starting the scanning process.

Parameters
startInPausedStateWhether the scanning process should be paused.
void startScanning ( boolean  startInPausedState,
Runnable  completionCallback 
)

Asynchronously start the camera preview and scanning process.

Allows to start the camera preview without immediately also starting the scanning process.

Parameters
startInPausedStateWhether the scanning process should be paused.
completionCallbackRunnable to be executed when the scanning has been started.
Since
4.15.0
void switchTorchOn ( boolean  on)

Switches the torch (if available) on or off programmatically.

There is also a method in the ScanditSDKOverlayController to add a torch icon that the user can click to activate the torch.

Parameters
ontrue when the torch should be switched on, false if the torch should be turned off.
ScanOverlay getOverlayView ( )

The overlay view that controls the scan user interface.

The Scandit BarcodeScanner contains a default implementation that developers can inherit from to define their own scan UI (enterprise licensees only). The overlay view inherits from RelativeLayout.

Returns
the overlay view
void setProcessFrameListener ( ProcessFrameListener  processFrameListener)

Set listener to be called whenever a frame has been processed.

Parameters
processFrameListenerthe listener to register.
static boolean canRunPortraitPicker ( )
static
Returns
True if the BarcodePicker can be used in portrait scanning mode. This method only returns false on a few selected Android 2.3+ devices that have incomplete camera drivers.
Point convertPointToPickerCoordinates ( Point  point)

Converts a point of an Barcode's location into this picker's coordinate system.

The conversion takes the current resolution of the camera feed into consideration which means that if the resolution should change, converting a previously retrieved point successfully is no longer possible. A change in resolution happens for example if ScanSettings.setHighDensityModeEnabled(boolean) is changed or the camera is switched from back to front or vice versa.

Parameters
pointThe point to be converted.
Returns
The point in this picker's coordinate system. Can be null if an error occurs.
See also
com.scandit.recognition.Barcode.getLocation()
void setPinchToZoomEnabled ( boolean  enabled)

Enable/disable pinch to zoom.

By default, the video zoom factor can be controlled with a pinch gesture. Set this property to false to disable this feature.

Parameters
enabledWhether to enable the pinch to zoom functionality
Since
4.15

The documentation for this class was generated from the following file:
  • BarcodePicker.java