public abstract class

BarcodeScannerScreen

extends Screen
java.lang.Object
   ↳ com.neomades.app.Screen
     ↳ com.neomades.barcode.BarcodeScannerScreen

Class Overview

Screen that opens the camera to scan for bar code.

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

By default, a BarcodeScannerScreen 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.

Screen and BarcodeScanner life cycle

The camera of the BarcodeScanner is not automatically started. To start it, a call to startBarcodeScanner() must be done. To start the camera immediately when the screen appears, call the start method in the onResume() of the screen. Calling start in onCreate() may result in undefined behaviors.

Camera must be stopped when the screen is exited. 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 Constants
From class com.neomades.app.Screen
From interface com.neomades.app.Keys
From interface com.neomades.app.Orientation
From interface com.neomades.ui.Alignment
From interface com.neomades.ui.StretchMode
[Expand]
Inherited Fields
From class com.neomades.app.Screen
Public Constructors
BarcodeScannerScreen()
Public Methods
BarcodeScanner getBarcodeScanner()
Returns the BarcodeScanner of this screen.
BarcodeScannerView getBarcodeScannerView()
Returns the BarcodeScannerView that occupies all the screen.
void setBarcodeScanner(BarcodeScanner scanner)
Associates a BarcodeScanner with this screen.
void startBarcodeScanner()
Starts the camera to track bar codes.
void stopBarcodeScanner()
Stops the camera tracking.
[Expand]
Inherited Methods
From class com.neomades.app.Screen
From class java.lang.Object

Public Constructors

public BarcodeScannerScreen ()

Public Methods

public BarcodeScanner getBarcodeScanner ()

Returns the BarcodeScanner of this screen.

By default, the screen has a BarcodeScanner configured to track QR Code.

Returns
  • the BarcodeScanner of this screen

public BarcodeScannerView getBarcodeScannerView ()

Returns the BarcodeScannerView that occupies all the screen.

Returns
  • the BarcodeScannerView of the screen

public void setBarcodeScanner (BarcodeScanner scanner)

Associates a BarcodeScanner with this screen.

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.

public void stopBarcodeScanner ()

Stops the camera tracking. The scan should be stopped in the onPause() method.