Volodymyr
Volodymyr

Reputation: 6569

whether there is any tutorial for android zxing library with Fragments

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?

Upvotes: 6

Views: 4144

Answers (2)

Art
Art

Reputation: 223

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/

Upvotes: 1

CommonsWare
CommonsWare

Reputation: 1006674

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());
        }
    }
    

Upvotes: 5

Related Questions