BarcodeScannerOptions.Builder

public static class BarcodeScannerOptions.Builder extends Object

Builder to build out a BarcodeScannerOptions.

Public Constructor Summary

Public Method Summary

BarcodeScannerOptions
build()
Builds a BarcodeScannerOptions instance.
BarcodeScannerOptions.Builder
enableAllPotentialBarcodes()
Returns all potential barcodes when enabled, even if they cannot be decoded.
BarcodeScannerOptions.Builder
setBarcodeFormats(int format, int... moreFormats)
Sets the interested barcode formats defined in Barcode.BarcodeFormat.
BarcodeScannerOptions.Builder
setExecutor(Executor executor)
Sets the custom Executor to use.
BarcodeScannerOptions.Builder

Inherited Method Summary

Public Constructors

public Builder ()

Builder for BarcodeScannerOptions.

Public Methods

public BarcodeScannerOptions build ()

Builds a BarcodeScannerOptions instance.

public BarcodeScannerOptions.Builder enableAllPotentialBarcodes ()

Returns all potential barcodes when enabled, even if they cannot be decoded.

Barcode.getRawBytes() and Barcode.getRawValue() will return null for any undecoded barcodes, but Barcode.getBoundingBox() will return the area potentially containing a barcode.

This can be used to facilitate further detection, e.g., by zooming in the camera to get a clearer image of any barcode in the returned bounding box.

public BarcodeScannerOptions.Builder setBarcodeFormats (int format, int... moreFormats)

Sets the interested barcode formats defined in Barcode.BarcodeFormat.

e.g. setBarcodeFormats(Barcode.FORMAT_QR_CODE, Barcode.FORMAT_UPC_A).

Reducing the number of supported formats will make the barcode scanner faster.

Only the last call will be respected if calling this method multiple times

Default: all formats are supported.

Parameters
format supported barcode format
moreFormats more supported barcode formats

public BarcodeScannerOptions.Builder setExecutor (Executor executor)

Sets the custom Executor to use. If no Executor is set, an internal background thread pool will be used.

Most clients should not need to call this method.

Parameters
executor the Executor to use
Returns
  • this object, for chaining method calls

public BarcodeScannerOptions.Builder setZoomSuggestionOptions (ZoomSuggestionOptions zoomSuggestionOptions)

Sets the ZoomSuggestionOptions to use.

If this is specified, then the library will suggest zooming the camera if the barcode is too far away or too small to be detected.

Parameters
zoomSuggestionOptions the ZoomSuggestionOptions to use
Returns
  • this object, for chaining method calls.