# LocalizedBarcodesUnit Class

`LocalizedBarcodesUnit` extends the [`IntermediateResultUnit`](https://www.dynamsoft.com/capture-vision/docs/mobile/programming/android/api-reference/core/intermediate-results/intermediate-result-unit.md) class and represents a unit which contains localized barcodes.

## Definition

*Assembly:* DynamsoftCaptureVisionBundle.aar

*Namespace:* com.dynamsoft.dbr.intermediate_results

```java
class LocalizedBarcodesUnit extends IntermediateResultUnit
```

## Methods

| Method | Description |
|--------|-------------|
| [`getLocalizedBarcodes`](#getlocalizedbarcodes) | Returns an array of `LocalizedBarcodeElement`. |
| [`getCount`](#getcount) | Returns the number of localized barcodes in the unit. |
| [`getLocalizedBarcode`](#getlocalizedbarcode) | Returns the `LocalizedBarcodeElement` at the specified index. |
| [`removeAllLocalizedBarcodes`](#removealllocalizedbarcodes) | Removes all the localized barcodes in the unit. |
| [`removeLocalizedBarcode`](#removelocalizedbarcode) | Removes the `LocalizedBarcodeElement` at the specified index from the unit. |
| [`addLocalizedBarcode`](#addlocalizedbarcode) | Add a new `LocalizedBarcodeElement` to the unit. |
| [`setLocalizedBarcode`](#setlocalizedbarcode) | Set a `LocalizedBarcodeElement` at the specified index. |

The following methods are inherited from class [`IntermediateResultUnit`](https://www.dynamsoft.com/capture-vision/docs/mobile/programming/android/api-reference/core/intermediate-results/intermediate-result-unit.md).

| Method | Description |
|------- |-------------|
| [`getHashId`](https://www.dynamsoft.com/capture-vision/docs-archive/mobile/programming/android/api-reference/core/intermediate-results/intermediate-result-unit.md#gethashid) | Gets the hash ID of the unit. |
| [`getOriginalImageHashId`](https://www.dynamsoft.com/capture-vision/docs-archive/mobile/programming/android/api-reference/core/intermediate-results/intermediate-result-unit.md#getoriginalimagehashid) | Gets the hash ID of the original image. |
| [`getOriginalImageTag`](https://www.dynamsoft.com/capture-vision/docs-archive/mobile/programming/android/api-reference/core/intermediate-results/intermediate-result-unit.md#getoriginalimagetag) | Gets the image tag of the original image. |
| [`getType`](https://www.dynamsoft.com/capture-vision/docs-archive/mobile/programming/android/api-reference/core/intermediate-results/intermediate-result-unit.md#gettype) | Gets the type of the intermediate result unit. |
| [`getTransformMatrix`](https://www.dynamsoft.com/capture-vision/docs-archive/mobile/programming/android/api-reference/core/intermediate-results/intermediate-result-unit.md#gettransformmatrix) | Gets the transformation matrix via [`DSTransformMatrixType`](https://www.dynamsoft.com/capture-vision/docs-archive/core/enums/core/transform-matrix-type.md). |
| [`clone`](https://www.dynamsoft.com/capture-vision/docs-archive/mobile/programming/android/api-reference/core/intermediate-results/intermediate-result-unit.md#clone) | Creates a copy of the intermediate result unit. |
| [`replace`](https://www.dynamsoft.com/capture-vision/docs-archive/mobile/programming/android/api-reference/core/intermediate-results/intermediate-result-unit.md#replace) | Replaces the content of the intermediate result unit. |

### getLocalizedBarcodes

Returns an array of [`LocalizedBarcodeElement`](https://www.dynamsoft.com/barcode-reader/docs/mobile/programming/android/api-reference/localized-barcode-element.md), which contains the detailed information for each localized barcode.

```java
LocalizedBarcodeElement[] getLocalizedBarcodes()
```

**Return value**

An array of [`LocalizedBarcodeElement`](https://www.dynamsoft.com/barcode-reader/docs/mobile/programming/android/api-reference/localized-barcode-element.md), which contains the detailed information for each localized barcode.

### getCount

Returns the number of localized barcodes ([`LocalizedBarcodeElement`](https://www.dynamsoft.com/barcode-reader/docs/mobile/programming/android/api-reference/localized-barcode-element.md)) in the unit.

```java
int getCount()
```

**Return Value**

The number of localized barcodes.

### getLocalizedBarcode

Returns the [`LocalizedBarcodeElement`](https://www.dynamsoft.com/barcode-reader/docs/mobile/programming/android/api-reference/localized-barcode-element.md) at the specified index.

```java
LocalizedBarcodeElement getLocalizedBarcode(int index)
```

**Parameters**

`[in] index`: The index of the localized barcode element.

**Return value**

The [`LocalizedBarcodeElement`](https://www.dynamsoft.com/barcode-reader/docs/mobile/programming/android/api-reference/localized-barcode-element.md) at the specified index.

### removeAllLocalizedBarcodes

Removes all the localized barcodes in the unit.

```java
void removeAllLocalizedBarcodes()
```

### removeLocalizedBarcode

Removes the [`LocalizedBarcodeElement`](https://www.dynamsoft.com/barcode-reader/docs/mobile/programming/android/api-reference/localized-barcode-element.md) at the specified index from the unit.

```java
int removeLocalizedBarcode(int index)
```

**Parameters**

`[in] index`: The index of the localized barcode element.

**Return value**

Returns the `ErrorCode` if it fails. Otherwise, returns 0.

### addLocalizedBarcode

Add a new [`LocalizedBarcodeElement`](https://www.dynamsoft.com/barcode-reader/docs/mobile/programming/android/api-reference/localized-barcode-element.md) to the unit.

```java
int addLocalizedBarcode(LocalizedBarcodeElement element, Matrix matrixToOriginalImage)
```

**Parameters**

`[in] element`: The `LocalizedBarcodeElement` to be added.

`[in] matrixToOriginalImage`: The transformation `Matrix` of the original image.

**Return value**

Returns the `ErrorCode` if it fails. Otherwise, returns 0.

### setLocalizedBarcode

Set a [`LocalizedBarcodeElement`](https://www.dynamsoft.com/barcode-reader/docs/mobile/programming/android/api-reference/localized-barcode-element.md) at the specified index.

```java
int setLocalizedBarcode(int index, LocalizedBarcodeElement element, Matrix matrixToOriginalImage)
```

**Parameters**

`[in] index`: The index where the localized barcode element will be set.

`[in] element`: The `LocalizedBarcodeElement` to be set.

`[in] matrixToOriginalImage`: The transformation `Matrix` of the original image.

**Return value**

Returns the `ErrorCode` if it fails. Otherwise, returns 0.
