@Override
        public boolean handleMessage(Message message) {
            if (message.what == R.id.zxing_decode_succeeded) {
                BarcodeResult result = (BarcodeResult) message.obj;

                if (result != null) {
                    if (callback != null && decodeMode != DecodeMode.NONE) {
                        callback.barcodeResult(result);
                        if (decodeMode == DecodeMode.SINGLE) {
                            stopDecoding();
                        }
                    }
                }
                return true;
            } else if (message.what == R.id.zxing_decode_failed) {
                // Failed. Next preview is automatically tried.
                return true;
            } else if (message.what == R.id.zxing_possible_result_points) {
                //noinspection unchecked
                List<ResultPoint> resultPoints = (List<ResultPoint>) message.obj;
                if (callback != null && decodeMode != DecodeMode.NONE) {
                    callback.possibleResultPoints(resultPoints);
                }
                return true;
            }
            return false;
        }
A view for scanning barcodes.

Two methods MUST be called to manage the state:
1. resume() - initialize the camera and start the preview. Call from the Activity's onResume().
2. pause() - stop the preview and release any resources. Call from the Activity's onPause().

Start decoding with decodeSingle() or decodeContinuous(). Stop decoding with stopDecoding().

@see CameraPreview for more details on the preview lifecycle.
zxing-android-embedded/src/com/journeyapps/barcodescanner/BarcodeView.java