Stack Exchange
How to Disable multiple barcode detection android Vision API
I'm trying to disable multiple Barcode detection at time.
How to disable MultiProcessor using Google Vision API, I couldn't find any solution from official site here
I have downloaded sample from here
Code 
BarcodeDetector barcodeDetector = new BarcodeDetector.Builder(context).build();
    BarcodeTrackerFactory barcodeFactory = new BarcodeTrackerFactory(mGraphicOverlay);
    barcodeDetector.setProcessor(
            new MultiProcessor.Builder<>(barcodeFactory).build());

Even if remove below line, I cannot detect at all.
 barcodeDetector.setProcessor(
        new MultiProcessor.Builder<>(barcodeFactory).build());


I think You might want this,
http://stackoverflow.com/questions/32999813/preview-size-for-barcode-scanner-from-vision-api/34156158#34156158

No. please read what I'm asking.

I have resolved this multiple Barcode detection at same time by exploring sample code and some logic implementation.
Solution is : stop mPreview and start again after 1 second delay
Create callback listener 
public interface BarCodeDetectListener {
void onBarCodeDetect(Barcode barcode);
}

BarcodeGraphicTracker
When device detected Barcode inside onNewItem() callback to Barcodefragment
class BarcodeGraphicTracker extends Tracker<Barcode> {
...
...
private BarcodeGraphic mGraphic;
private BarCodeDetectListener barCodeDetectListener;
...

 /**
  * Start tracking the detected item instance within the item overlay.
  */
 @Override
 public void onNewItem(int id, Barcode item) {
    mGraphic.setId(id);
    barCodeDetectListener.onBarCodeDetect(item);
 }
}

BarCodeFragment
@SuppressLint("NewApi")
public class SurveyBarCodeFragment extends Fragment implements BarCodeDetectListener {
  ...
  private CameraSourcePreview mPreview;
  private CameraSource mCameraSource;
  ...



 @Override
 public void onBarCodeDetect(final Barcode barcode) {
  new Handler().post(new Runnable() {
        @Override
        public void run() {
            mPreview.stop(); //Stop preview
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    try {
                        if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
                            // TODO: Consider calling
                            //    ActivityCompat#requestPermissions
                            // here to request the missing permissions, and then overriding
                            //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
                            //                                          int[] grantResults)
                            // to handle the case where the user grants the permission. See the documentation
                            // for ActivityCompat#requestPermissions for more details.
                            return;
                        }
                        //Start preview after 1s delay
                        mPreview.start(mCameraSource);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }, 1000);
        }
    });

 }
}


Update your BarcodeGraphicTracker and implement onNewItem function as below:
public class BarcodeGraphicTracker extends Tracker<Barcode> {

        private static final String TAG = "Barcode-reader";
        @Override
        public void onNewItem(int id, final Barcode item) {
            Log.d(TAG, "Detected!!"+ item.toString());
                Runnable r=new Runnable()
                {
                    public void run()
                    {
                        //write your code here
                        }
                    }
                };
                getActivity().runOnUiThread(r);
        }

        @Override
        public void onUpdate(Detector.Detections<Barcode> detectionResults, Barcode item) {

        }
    }

and BarcodeTrackerFactory as:
public class BarcodeTrackerFactory implements MultiProcessor.Factory<Barcode> {

        @Override
        public Tracker<Barcode> create(Barcode barcode) {
            return new BarcodeGraphicTracker();
        }

    }


What about GraphicOverlay?. I think it will not work without GraphicOverlay

Keep the entire code as it was in the sample code. Just cut the code from onUpdate and paste it in onNewItem and then try.

Doesn't detect anything!!
