# Print output for @column tags ?>
public
class
ScannerFragment
extends Fragment
implements
TextureView.SurfaceTextureListener
java.lang.Object | ||
↳ | android.app.Fragment | |
↳ | com.vuzix.sdk.barcode.ScannerFragment |
ScannerFragment is an easy way to add barcode scanning functionality to your app. To use, follow these steps:
Nested classes | |
---|---|
interface |
ScannerFragment.Listener
Interface for those who want to be notified when a barcode is identified. |
interface |
ScannerFragment.Listener2
|
Constants | |
---|---|
String |
ARG_BARCODE2_TYPES
A string array argument for specifying barcode types to scan for. |
String |
ARG_BARCODE_TYPES
This constant is deprecated. As of Scanner 2 |
String |
ARG_CAMERA_ID
A String argument for specifying the desired camera to use arguments.putString(ScannerFragment.ARG_CAMERA_ID, 1); |
String |
ARG_LICENSE_KEY
This constant is deprecated. As of Scanner 2 |
String |
ARG_SCANNING_RECT
A parcelable argument for specifying the scanning rect. |
String |
ARG_ZOOM_IN_MODE
A boolean argument for barcode run in zoom mode. |
Public constructors | |
---|---|
ScannerFragment()
|
Public methods | |
---|---|
void
|
onCreate(Bundle savedInstanceState)
|
View
|
onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
void
|
onStart()
|
void
|
onStop()
|
void
|
onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height)
|
boolean
|
onSurfaceTextureDestroyed(SurfaceTexture surface)
|
void
|
onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height)
|
void
|
onSurfaceTextureUpdated(SurfaceTexture surface)
|
void
|
setListener(ScannerFragment.Listener listener)
This method is deprecated. As of Scanner 2 |
void
|
setListener2(ScannerFragment.Listener2 listener)
Register a callback to be invoked when a barcode is located or an error occurs. |
public static final String ARG_BARCODE2_TYPES
A string array argument for specifying barcode types to scan for. Each string should be the name() of a BarcodeType2. For example:
arguments.putStringArray(ScannerFragment.ARG_BARCODE2_TYPES, new String[] {BarcodeType2.QR.name(), BarcodeType2.QR_MICRO.name()});
Constant Value: "barcode2_types"
public static final String ARG_BARCODE_TYPES
This constant is deprecated.
As of Scanner 2
A string array argument for specifying barcode types to scan for. Each string should be the name() of a BarcodeType. For example:
arguments.putStringArray(ScannerFragment.ARG_BARCODE_TYPES, new String[] {BarcodeType.QR.name(), BarcodeType.QR_MICRO.name()});
Constant Value: "barcode_types"
public static final String ARG_CAMERA_ID
A String argument for specifying the desired camera to use
arguments.putString(ScannerFragment.ARG_CAMERA_ID, 1);
Constant Value: "camera_id"
public static final String ARG_LICENSE_KEY
This constant is deprecated.
As of Scanner 2
A string argument for specifying a custom license key.
Constant Value: "license_key"
public static final String ARG_SCANNING_RECT
A parcelable argument for specifying the scanning rect. For example:
arguments.putParcelable(ScannerFragment.ARG_SCANNING_RECT, new ScanningRect(.5f, .5f));
Constant Value: "scanning_rect"
public static final String ARG_ZOOM_IN_MODE
A boolean argument for barcode run in zoom mode. For example:
arguments.putBoolean(ScannerFragment.ARG_ZOOM_MODE, true);
Constant Value: "zoom_in_mode"
public ScannerFragment ()
public void onCreate (Bundle savedInstanceState)
Parameters | |
---|---|
savedInstanceState |
Bundle |
public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
Parameters | |
---|---|
inflater |
LayoutInflater |
container |
ViewGroup |
savedInstanceState |
Bundle |
Returns | |
---|---|
View |
public void onStart ()
public void onStop ()
public void onSurfaceTextureAvailable (SurfaceTexture surface, int width, int height)
Parameters | |
---|---|
surface |
SurfaceTexture |
width |
int |
height |
int |
public boolean onSurfaceTextureDestroyed (SurfaceTexture surface)
Parameters | |
---|---|
surface |
SurfaceTexture |
Returns | |
---|---|
boolean |
public void onSurfaceTextureSizeChanged (SurfaceTexture surface, int width, int height)
Parameters | |
---|---|
surface |
SurfaceTexture |
width |
int |
height |
int |
public void onSurfaceTextureUpdated (SurfaceTexture surface)
Parameters | |
---|---|
surface |
SurfaceTexture |
public void setListener (ScannerFragment.Listener listener)
This method is deprecated.
As of Scanner 2
Register a callback to be invoked when a barcode is located or an error occurs. To remove yourself as a listener, set the listener to null.
Parameters | |
---|---|
listener |
ScannerFragment.Listener : a ScannerFragment.Listener
|
public void setListener2 (ScannerFragment.Listener2 listener)
Register a callback to be invoked when a barcode is located or an error occurs. To remove yourself as a listener, set the listener to null.
Parameters | |
---|---|
listener |
ScannerFragment.Listener2 : a ScannerFragment.Listener2
|