I'm looking for some tutorial or sample how to use Zxing library within android's Fragment.
UPDATE:
Using IntentIntegratorSupportV4 can I use only scanner if it installed on device or in my own app? Because I want to use QR Scanner in my own app which has two tabs. In fist must be this scanner. How I can handle it?
Follow all the below steps very carefully to add Zxing library in your project. 1. Open your Project’s build.gradle ( Module : app ) and add com.android.support:appcompat-v7:23.4.0 library file. 2. Here is the code to add appcompat library inside build.gradle file.
Provide a simple library to scan codes using ZXing's core library. Be compatible with Android 2.1 and up. Work out of the box (or almost). Facilitate customization and/or configuration.
Google uses ZXing by web search to obtain millions of barcodes on the web indexable. It also creates the foundation of Android’s Barcode Scanner app and is combined into Google Product and Book Search.
The project is loosely based on the ZXing Android Barcode Scanner application, but is not affiliated with the official ZXing project. Can be used via Intents (little code required). Can be embedded in an Activity, for advanced customization of UI and logic. Scanning can be performed in landscape or portrait mode.
This sample project demonstrates the use of IntentIntegrator
, and you will find a compiled JAR containing that class in the project's libs/
directory.
There are really only two steps:
Call (new IntentIntegrator(this)).initiateScan();
to bring up the scanner.
Implement onActivityResult()
and use IntentIntegrator
to help parse the results:
public void onActivityResult(int request, int result, Intent i) {
IntentResult scan=IntentIntegrator.parseActivityResult(request, result, i);
if (scan!=null) {
format.setText(scan.getFormatName());
contents.setText(scan.getContents());
}
}
Here is a tutorial on integrating it into your own app. Although this is not recommended
http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With