# BarcodeScannerOptions.Builder

public static class **BarcodeScannerOptions.Builder** extends [Object](https://developer.android.com/reference/java/lang/Object.html)  
Builder to build out a `https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions`.

### Public Constructor Summary

|---|---|
|   | [Builder](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions.Builder#Builder())() Builder for `https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions`. |

### Public Method Summary

|---|---|
| [BarcodeScannerOptions](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions) | [build](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions.Builder#build())() Builds a `https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions` instance. |
| [BarcodeScannerOptions.Builder](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions.Builder) | [enableAllPotentialBarcodes](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions.Builder#enableAllPotentialBarcodes())() Returns all potential barcodes when enabled, even if they cannot be decoded. |
| [BarcodeScannerOptions.Builder](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions.Builder) | [setBarcodeFormats](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions.Builder#setBarcodeFormats(int,%20int...))(int format, int... moreFormats) Sets the interested barcode formats defined in `https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/common/Barcode.BarcodeFormat`. |
| [BarcodeScannerOptions.Builder](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions.Builder) | [setExecutor](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions.Builder#setExecutor(java.util.concurrent.Executor))([Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html) executor) Sets the custom `https://developer.android.com/reference/java/util/concurrent/Executor.html` to use. |
| [BarcodeScannerOptions.Builder](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions.Builder) | [setZoomSuggestionOptions](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions.Builder#setZoomSuggestionOptions(com.google.mlkit.vision.barcode.ZoomSuggestionOptions))([ZoomSuggestionOptions](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/ZoomSuggestionOptions) zoomSuggestionOptions) Sets the `https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/ZoomSuggestionOptions` to use. |

### Inherited Method Summary

From class java.lang.Object

|---|---|
| [Object](https://developer.android.com/reference/java/lang/Object.html) | clone() |
| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object.html) arg0) |
| void | finalize() |
| final [Class](https://developer.android.com/reference/java/lang/Class.html)\<?\> | getClass() |
| int | hashCode() |
| final void | notify() |
| final void | notifyAll() |
| [String](https://developer.android.com/reference/java/lang/String.html) | toString() |
| final void | wait(long arg0, int arg1) |
| final void | wait(long arg0) |
| final void | wait() |

## Public Constructors

#### public **Builder** ()

Builder for `https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions`.

## Public Methods

#### public [BarcodeScannerOptions](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions)
**build** ()

Builds a `https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions`
instance.

#### public [BarcodeScannerOptions.Builder](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions.Builder)
**enableAllPotentialBarcodes** ()

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

`https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/common/Barcode#getRawBytes()`
and `https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/common/Barcode#getRawValue()`
will return `null` for any undecoded barcodes, but `https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/common/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](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions.Builder)
**setBarcodeFormats** (int format, int... moreFormats)

Sets the interested barcode formats defined in `https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/common/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](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions.Builder)
**setExecutor** ([Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html) executor)

Sets the custom `https://developer.android.com/reference/java/util/concurrent/Executor.html`
to use. If no `https://developer.android.com/reference/java/util/concurrent/Executor.html`
is set, an internal background thread pool will be used.

Most clients should not need to call this method.

##### Parameters

| executor | the `https://developer.android.com/reference/java/util/concurrent/Executor.html` to use |
|---|---|

##### Returns

- this object, for chaining method calls

#### public [BarcodeScannerOptions.Builder](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/BarcodeScannerOptions.Builder)
**setZoomSuggestionOptions** ([ZoomSuggestionOptions](https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/ZoomSuggestionOptions) zoomSuggestionOptions)

Sets the `https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/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 `https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/ZoomSuggestionOptions` to use |
|---|---|

##### Returns

- this object, for chaining method calls.