Copy

http://code.google.com/p/zxing/source/browse/trunk/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java

and

http://code.google.com/p/zxing/source/browse/trunk/android-integration/src/com/google/zxing/integration/android/IntentResult.java

into your source code, then...

In the activity that you want to trigger a barcode scan include
(probably in an OnClickHandler()):

IntentIntegrator.initiateScan(YourActivity.this);

and then also include:

protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
    switch(requestCode) {
        case IntentIntegrator.REQUEST_CODE: {
            if (resultCode != RESULT_CANCELED) {
                IntentResult scanResult =
IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
                if (scanResult != null) {
                    String upc = scanResult.getContents()
                    // Do whatever you want with the barcode...
                }
            }
            break;
        }
    }
}


The Barcode Scanner app will handle the actual scanning. If the
Barcode Scanner app is not installed, the integrator will prompt them
to install it.

On Nov 17, 2:28 pm, Jose Gomez <j...@josecgomez.com> wrote:
> Hello All,
>
> I am writing an application that needs the ability to scan barcodes. I know
> that the ZXING Library can be used for this but I can't find a resource only
> that has a tutorial on how to use this library in your app. I want to be
> able to install my app
> and if the ZXING library isn't installed maybe install it too?
>
> Thansk!
>
> Sincerely
> Jose C Gomez
>
> http://www.josecgomez.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to