I want to implement QR Code Reader for android. I used This Solution but it only opens camera, captures image but do nothing. I would like to know the best to do it (DISREGARDING intent integrator from zxing)
-
zxing is time consuming.Try zbar.It is vert fast.You dont need to show progressbar. – kgandroid Aug 07 '14 at 11:22
-
I am generating codes by using ZXING. can i use ZBAR for scanning only? – user3917800 Aug 07 '14 at 11:24
-
Does this answer your question? [How to scan QRCode in android](https://stackoverflow.com/questions/8830647/how-to-scan-qrcode-in-android) – Josh Correia Sep 17 '20 at 18:30
4 Answers
Since the questioner states that he/she wants to do it without ZXing I'll throw in my favorite option: use Google's own version available through Google Play services in the namespace com.google.android.gms.vision.barcode
. This solution is fast robust and accurate and it supports all standard formats.
To get up and running in no time give Android QR Code Reader Made Simple a chance! This will give you full control of the source code and you can easily continue to build further on the code provided or equally easily implement it in you existing project.
Give it a try!

- 5,734
- 3
- 34
- 51
Download zxing in your mobile. And use the following..
Intent intent = new Intent(
"com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 1);
Override the following function
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1)
if (resultCode == Activity.RESULT_OK) {
String contents = data.getStringExtra("SCAN_RESULT");
String format = data.getStringExtra("SCAN_RESULT_FORMAT");
Toast.makeText(getApplicationContext(), contents, Toast.LENGTH_SHORT).show();
// TODO: Do something here with it
}// if result_ok
}// onactivityresult
It's 100% working..
Answer might be outdated.

- 11,216
- 8
- 63
- 98
-
6
-
Its working fine but i want to show some progress dialog kind of thing while detecting the QR Code so user get to know that it is detecting the QR Code. Here is the screenshot of QR Detection - http://postimg.org/image/5pcja6mcz/ – user3917800 Aug 07 '14 at 11:18
-
-
-
-
Progress dialog is not necessary. and sometimes it is slow. I want to do it for user ease – user3917800 Aug 07 '14 at 11:23
-
-
Please make a new question. That is how it goes here in stackoverflow. Single solution to single question page. Sorry – Nabin Aug 07 '14 at 11:25
-
And do u know how can i make dialog boxes for QR action. Rather than using Toast as used by you in answer – user3917800 Aug 07 '14 at 11:29
I had the same issue in the past, and the solution was to download the source code of Zxing (https://github.com/zxing/zxing) and integrate it inside my application, like this you don't have to use intent. Believe me, it's not much difficult;)

- 739
- 3
- 19
Edit build.gradle (App) file & add below dependencies:
compile 'com.journeyapps:zxing-android-embedded:3.4.0'
Declare below variable in Activity class:
IntentIntegrator qrScan;
In OnCreate method write below code:
qrScan = new IntentIntegrator(this);
qrScan.setDesiredBarcodeFormats(IntentIntegrator.ALL_CODE_TYPES);
your button function like below:
public void startScan(View view) {
qrScan.initiateScan();
}
Now it will start Scanning but it requires below method to read result: So ovveride the OnActivityResult method like below of the same Activity:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
if (result != null) {
if (result.getContents() == null) {
Toast.makeText(this, "Result Not Found", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, result.getContents() ,Toast.LENGTH_LONG).show();
txt.setText(result.getContents());
qrScan.initiateScan();
}
}
}
Please refer below link it will give you more idea in Simple form. https://www.simplifiedcoding.net/android-qr-code-scanner-tutorial/

- 810
- 8
- 11