Barcode Selection Session#

Defined in package com.scandit.datacapture.barcode.selection

class BarcodeSelectionSession

Added in version 6.9.0

Holds the ongoing state of a running BarcodeSelection. An instance of this class is passed to BarcodeSelectionListener.onSelectionUpdated() when new barcodes are selected or currently selected barcodes are unselected.


The barcode selection session should only be accessed from within onSelectionUpdated() to which it is provided as an argument. It is not safe to be accessed from anywhere else since it may be concurrently modified.

Specifically no reference to selectedBarcodes should be kept and traversed outside of onSelectionUpdated(). Instead a copy of the list should be made to avoid concurrent modification. The individual barcodes can be referenced without copying as they are not further modified.

@NonNull List<@NonNull Barcode> getNewlySelectedBarcodes()

Added in version 6.9.0

List of codes that were newly selected in the last processed frame.

@NonNull List<@NonNull Barcode> getNewlyUnselectedBarcodes()

Added in version 6.9.0

List of codes that were unselected in the last processed frame.

@NonNull List<@NonNull Barcode> getSelectedBarcodes()

Added in version 6.9.0

List of currently selected codes.

void selectUnselectedBarcodes()

Added in version 6.12.0

Select all the unselected barcodes that are currently being tracked in this barcode selection session.

void reset()

Added in version 6.9.0

Resets the barcode selection session, effectively clearing the history of selected codes.

int getCount(@NonNull Barcode barcode)

Added in version 6.9.0

Returns how many times the given Barcode was selected.

long getFrameSequenceId()

Added in version 6.9.0

The identifier of the current frame sequence.


As long as there is no interruptions of frames coming from the camera, the frameSequenceId will stay the same.

int getLastProcessedFrameId()

Added in version 6.9.0

The identifier of the last processed frame.

@NonNull String toJson()

Added in version 6.10.0

Returns the JSON representation of the barcode tracking session.