title: Android ZXingScanner (QR Scanner) and Torch
body: <p>I added ZXing qr scanner to my android project with compile 'me.dm7.barcodescanner:zxing:1.8.4'.</p>
  
  <p>I am displaying the qrcode scanner inside of a fragment.  I can scan and read without any problems.  The issue I am having is trying to turn the flash (torch) on while the camera is scanning.</p>
  
  <p>this code scans perfectly</p>
  
  <pre><code>   View view = inflater.inflate(R.layout.fragment_qrscan, container, false);
        mScannerView = new ZXingScannerView(getActivity());   
        mScannerView.setResultHandler(this); // Register ourselves as a   
        mScannerView.startCamera();
        return mScannerView;
  </code></pre>
  
  <p>this code turns on the torch perfectly</p>
  
  <pre><code>        camera = Camera.open();
          Camera.Parameters parameters = camera.getParameters();
          parameters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
          camera.setParameters(parameters);
          camera.startPreview();
          return view;
  </code></pre>
  
  <p>If I try to turn the light on and return mScannerview the scanner works but the light goes off.  I can't seem to get the light and the qr scanner to work together successfully. The light does not work or my code will throw an exception depending on the code I try.  I have tried to use the first bit of code and turn on the torch in the onResume().  But I am not successful.  It is not a permission issue I can turn the light on and off without issues.  I can scan no problem.  But I can not scan with the light on.</p>
  
  <p>Any help or suggestions would be greatly appreciated.</p>