Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

whether there is any tutorial for android zxing library with Fragments

Tags:

android

zxing

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?

like image 275
Volodymyr Avatar asked Oct 06 '12 18:10

Volodymyr


People also ask

How to add ZXing library in your Android project?

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.

What can I do with ZXing?

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.

How does Google use ZXing?

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.

What is this ZXing project?

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.


Video Answer


2 Answers

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:

  1. Call (new IntentIntegrator(this)).initiateScan(); to bring up the scanner.

  2. 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());
        }
    }
    
like image 133
CommonsWare Avatar answered Oct 19 '22 22:10

CommonsWare


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/

like image 40
Art Avatar answered Oct 19 '22 22:10

Art