How To Get Qr Code Type
Solution 1:
You can modifie the CaptureActivity
of the library to get the QR Code type into your Activity.
In CaptureActivity
there is a method name handleDecodeExternally
which returns the data to your Activity add this line
intent.putExtra("QR_TYPE", getString(resultHandler.getDisplayTitle()));
before the Activity finishes.
And then get this value to your Activity's onActivityResult
Stringtype = intent.getStringExtra("QR_TYPE");
Finally you have the type of QR Code.
Thank you
Edit
In your zixing library project under com.google.zxing.client.android
package there is an Activity named CaptureActivity
. And on that Activity there is method
named handleDecodeExternally
which Briefly show the contents of the barcode, then handle the result outside Barcode Scanner. In that method there is an intent by which you have send the data what you found on QR to your activity.
add that line before you leave this activity, After adding it will be like this --
// ------------- Mine Added -------------------
intent.putExtra("QR_TYPE", getString(resultHandler.getDisplayTitle()));
// --------------------------------------------sendReplyMessage(R.id.return_scan_result, intent);
i think you will find this sendReplyMessage(R.id.return_scan_result, intent);
in 650 +/- line in CaptureActivity
. Thank you
Solution 2:
You shouldn't be getting the result from the returned Intent
's extras yourself.
Instead, do it like so:
IntentResultscanResult= IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
You can then get all the data you need through the IntentResult
. Specifically to get the type, you can call scanResult.getFormatName()
Post a Comment for "How To Get Qr Code Type"