public class

BarcodeScannerView

extends View
java.lang.Object
   ↳ com.neomades.ui.View
     ↳ com.neomades.barcode.BarcodeScannerView

Class Overview

View directly linked with the camera that scans for bar codes.

Use setBarcodeScanner(BarcodeScanner) to define what kind of bar code to track and to perform customized action when a bar code has been detected.

By default, a BarcodeScannerView has a configured BarcodeScanner to track QR-Code. The action to perform when a QR-Code is found can be changed by setting a BarcodeListener on the default scanner.

View and BarcodeScanner life cycle

The BarcodeScanner (and thus the camera that performs the scan) must be manually started using startBarcodeScanner(). Without that, the camera will not start and the view will remain empty. Avoid to call startBarcodeScanner() during the onCreate() method of the screen, it may result in unexpected behaviors.

In the same way, the BarcodeScanner must be stopped before exiting the screen. The best way to do that is to call stopBarcodeScanner() in the onPause() method of the screen.

The BarcodeScanner automatically stops when a bar code is detected. To restart the scan, a call to startBarcodeScanner() must be done.

Summary

[Expand]
Inherited XML Attributes
From class com.neomades.ui.View
[Expand]
Inherited Constants
From interface com.neomades.ui.Alignment
From interface com.neomades.ui.StretchMode
Public Constructors
BarcodeScannerView()
Public Methods
BarcodeScanner getBarcodeScanner()
Returns the BarcodeScanner of this view.
void setBarcodeScanner(BarcodeScanner scanner)
Associates a BarcodeScanner with this view.
void startBarcodeScanner()
Starts the camera to track bar codes.
void stopBarcodeScanner()
Stops the camera tracking.
[Expand]
Inherited Methods
From class com.neomades.ui.View
From class java.lang.Object

Public Constructors

public BarcodeScannerView ()

Public Methods

public BarcodeScanner getBarcodeScanner ()

Returns the BarcodeScanner of this view.

By default, the view has a BarcodeScanner configured to track for QR-Code.

Returns
  • the BarcodeScanner of this view

public void setBarcodeScanner (BarcodeScanner scanner)

Associates a BarcodeScanner with this view.

This will indicate to the camera what kind of bar code to track and what to do when found.

Parameters
scanner a BarcodeScanner

public void startBarcodeScanner ()

Starts the camera to track bar codes. The scan should be started in the onResume() method of the screen that contains this view.

public void stopBarcodeScanner ()

Stops the camera tracking. The scan should be stopped in the onPause() method of the screen that contains this view.