title: Stop camera and refresh
body: <p>This dialog is shown as many times as it scans the given Qr Code. How to do to read the value of the given QR code stopped the camera and how to press the ok button, the camera refreshed.  </p>
  
  <p>this is my code </p>
  
  <pre><code>private CameraSource mCameraSource;
  private CameraSourcePreview mPreview;
  
    @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_scan_activity2);
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
          toolbar.setNavigationIcon(R.drawable.ic_restart);
  
          Typeface custom_fonts = Typeface.createFromAsset(getAssets(), "fonts/OpenSans-Regular.ttf");
          title_app = (TextView) findViewById(R.id.title_application_scan);
          title_app.setTypeface(custom_fonts);
  
          helper = new DatabaseHandler(this);
  
          Default app = (Default) getApplicationContext();
          passwordString = app.getUuidString();
          eightChars = getIntent().getStringExtra("eightChars");
  
          scanQrLayout = (LinearLayout) findViewById(R.id.topLayout);
          mPreview = (CameraSourcePreview) findViewById(R.id.preview);
          mGraphicOverlay = (GraphicOverlay&lt;BarcodeGraphic&gt;) findViewById(R.id.graphicOverlay);
  
          int rc = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
          if (rc == PackageManager.PERMISSION_GRANTED) {
              createCamera();
          } else {
              requestCameraPermission();
          }
      }
  
     private void createCamera() {
          boolean autoFocus = false;
          boolean useFlash = false;
  
          Context context = getApplicationContext();
          BarcodeDetector barcodeDetector = new BarcodeDetector.Builder(context).build();
          BarcodeTrackerFactory barcodeFactory = new BarcodeTrackerFactory(mGraphicOverlay);
          barcodeDetector.setProcessor(
                  new MultiProcessor.Builder&lt;&gt;(barcodeFactory).build());
  
          if (!barcodeDetector.isOperational()) {
              IntentFilter lowstorageFilter = new IntentFilter(Intent.ACTION_DEVICE_STORAGE_LOW);
              boolean hasLowStrage = registerReceiver(null, lowstorageFilter) != null;
              if (hasLowStrage) {
                  Toast.makeText(this, R.string.low_strange_error, Toast.LENGTH_SHORT).show();
              }
          }
  
          CameraSource.Builder builder = new CameraSource.Builder(getApplicationContext(), barcodeDetector)
                  .setFacing(CameraSource.CAMERA_FACING_BACK)
                  .setRequestedPreviewSize(1600, 1024)
                  .setRequestedFps(15.0f);
  
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
              builder = builder.setFocusMode(
                      autoFocus ? Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE : null);
          }
          mCameraSource = builder
                  .setFlashMode(useFlash ? Camera.Parameters.FLASH_MODE_TORCH : null)
                  .build();
  
          barcodeFactory.setNewBarcodeListener(new BarcodeTrackerFactory.OnNewBarcodeListener() {
              @Override
              public void onNewItem(final Barcode item) {
                  Log.d("BarcodeFound", "Found new barcode! " + item.rawValue);
                  title_app.post(new Runnable() {
                      @Override
                      public void run() {
  
                          String[] dataCard = new String[5];
  
  
  
                          Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
                          vibrator.vibrate(400);
                          barcodeString = item.displayValue;
  
  
                          if ( barcodeString == null) {
                              mPreview.stop();
                              showAlterDialog("Błędny QR Kod", "Podany kod QR code jest błędny. Zeskanuj go ponownie.");
  
                          }
  }
  </code></pre>