question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can I read QR code once and stop QrReader

See original GitHub issue

As in the examples, the QREeader reads continous. When I once read

 qreader = QREader.Builder(view.context, surface_view, QRDataListener { data ->
            printReadQrCode(data)
        }).facing(QREader.BACK_CAM)
                .enableAutofocus(true)
                .height(surface_view.height)
                .width(surface_view.width)
                .build()
    }

Here it prints continueous the read data object as long as I hold the scanner to the qr code. I would like to call printReadQrCode(data) only once it was read successfully… then stop the qreader and resume if required.

also

myTextView.post(new Runnable() {
                @Override
                public void run() {
                    myTextView.setText(data);
                }
            });

wont help, since I do not have any Views and I do not want to add artificially some View elements…

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
BhagirathParmarcommented, Feb 26, 2020

private void SetupQREader() { qrEader = new QREader.Builder(this, id_SurfaceView, new QRDataListener() { @Override public void onDetected(final String data) { Log.d(“QREader”, "Value : " + data);

            result.post(new Runnable() {
                @Override
                public void run() {
                    String msg;
                    result.setText(data);
                    qrEader.stop();
                    msg = result.getText().toString();
                    Log.e("XXXXX", msg);
                    Intent intent = new Intent(ac, QrCodeResult.class);
                    intent.putExtra("RESULT", msg);
                    startActivity(intent);
                }
            });
        }
    }).facing(QREader.BACK_CAM)
            .enableAutofocus(true)
            .height(id_SurfaceView.getHeight())
            .width(id_SurfaceView.getWidth())
            .build();
}

still getting Log two times ? why ? not understanding. and what is the use of qrEader.wait(); and how do i use and where to use?

call qReader.stop() after first scan. and use qReader.start() when need to start scanning again.

2reactions
MahmoudMabrokcommented, Jul 3, 2019

call qReader.stop() after first scan. and use qReader.start() when need to start scanning again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Enable or disable Scan QR Code from Internet app ...
No need to download a QR code scanner on the Galaxy S8,S9, Note 8 and other similar devices as there is one built...
Read more >
How to stop once QR code is scanned? - Stack Overflow
1 Answer 1 ... Just set result and call finish when your scan is completed in that activity. After that you need to...
Read more >
How to scan QR Codes with Android phones without an app
Need to know how to scan QR Code menus? Pull up the native camera and point it at the QR Code. The menu...
Read more >
How to scan a QR code on your Android phone or tablet
To scan QR code on Android, open the Camera app and position the QR code within the frame. If that doesn't work, you...
Read more >
Troubleshoot QR code scanning with your phone's camera
You'll usually need to scan a QR code when setting up a Nest product with the app. If your phone or tablet's camera...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found