The following method is in BarcodeCaptureActivity.java
of the sample code google shared on GitHub.
@Override
public void onBarcodeDetected(Barcode barcode) {
// I want to stop preview as well as freeze the screen
// when the first barcode is detected
// What do I add here?
}