-1

I am developeing a barcode app. in which captured barcode camera image are decode through ZXing library. so simply i have download jar file and add it as external jar. but my problem is that how can i start use of that class there are no sample code at all. so can you provide me some initial thing so i can easily go through that process.

smparkes
  • 13,807
  • 4
  • 36
  • 61
Nikunj Patel
  • 21,853
  • 23
  • 89
  • 133
  • I made code for barcode generate and scan barcode. You can follow this to get the Step By Step Code. https://stackoverflow.com/a/58742737/11613683 – Pramesh Bhalala Nov 07 '19 at 06:20

4 Answers4

2

Ok, Just go through the Zxing library source link, and look at Android-Integration part in which you can find how to use Android-Zxing library.

user370305
  • 108,599
  • 23
  • 164
  • 151
  • 1
    Look at example [Integrate zxing barcode scanner into your Android app natively using Eclipse](http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/) – user370305 Apr 10 '12 at 09:35
  • I made code for barcode generate and scan barcode. You can follow this to get the Step By Step Code. https://stackoverflow.com/a/58742737/11613683 – Pramesh Bhalala Nov 07 '19 at 09:27
1

The way to call the ZXing SCAN Intent from your application, like this:

public Button.OnClickListener mScan = new Button.OnClickListener() {
    public void onClick(View v) {
        Intent intent = new Intent("com.google.zxing.client.android.SCAN");
        intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
        startActivityForResult(intent, 0);
    }
};

public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if (requestCode == 0) {
        if (resultCode == RESULT_OK) {
            String contents = intent.getStringExtra("SCAN_RESULT");
            String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
            // Handle successful scan
        } else if (resultCode == RESULT_CANCELED) {
            // Handle cancel
        }
    }
}

Ref:http://code.google.com/p/zxing/wiki/ScanningViaIntent

Sample code:http://as400samplecode.blogspot.in/2011/09/android-barcode-scanner-using-zxing.html
Karthi
  • 13,624
  • 10
  • 53
  • 76
  • i know this but can you tell me, is it only way that continue with intent. can we use class of zXing ? and if yes that how can we start? – Nikunj Patel Apr 10 '12 at 09:35
  • so can you tell me which thing reqired in device which is get responce of intent – Nikunj Patel Apr 10 '12 at 10:43
  • I made code for barcode generate and scan barcode. You can follow this to get the Step By Step Code. https://stackoverflow.com/a/58742737/11613683 – Pramesh Bhalala Nov 07 '19 at 06:21
0

If you don't want to use intent method, you can use few classes of ZXing directly in your project.

I did the same following these 2 stackoverflow posts

How to use zxing core as library on my Android project?

Embedding ZXing in android app

After copying the basic classes, you can strip down parts of code of the class CaptureActivity.java (this is the main activity class) by trial and error method.

Community
  • 1
  • 1
DSP
  • 487
  • 2
  • 5
  • 18
0

My way was to import the code into a helloworld, get it working and then play around it by importing this as a subproject. I have also uploaded this hello world project to 4shared. Refer to this post.

Community
  • 1
  • 1
Siddharth
  • 9,349
  • 16
  • 86
  • 148