-3

I would like to implement a barcode scanner function in my app.

I found this tutorial.

Problem is, that I work with Android studio and not with eclipse. if I understand this tutorial, I can use the scan function of zxing in my app without installing a third app.

Can anyone explain to me how I can use this function in my app?

Peter O.
  • 32,158
  • 14
  • 82
  • 96
Trombone0904
  • 4,132
  • 8
  • 51
  • 104
  • What is your real problem? – Krzysztof Cichocki Dec 08 '15 at 07:18
  • Step 2: Import ZXing Android project You need to import the ZXing Android project in Eclipse. Once imported right click the Project –> Properties –> Android and tick mark the Is Library checkbox. Also, create a new folder called libs within the project and add the core.jar file. The core.jar can be downloaded from over here. How i do this import with android studio? – Trombone0904 Dec 08 '15 at 07:19
  • So your problem is how to import a library into android studio or how to code with zxing library? – Krzysztof Cichocki Dec 08 '15 at 07:21
  • Related:http://stackoverflow.com/questions/18543668/integrate-zxing-in-android-studio – Payal Dec 08 '15 at 07:21
  • @Krzysztof Cichocki: yes – Trombone0904 Dec 08 '15 at 07:28

1 Answers1

0

I would like to suggest you one other way. download this project and add BarCodeScanner

for opening an bar code scanner on any click event call this capture activity form intent like this :

Intent intent = new Intent(MainActivity.this, CaptureActivity.class);
            startActivityForResult(intent, 2);

OnActivityResult()

onActivityResult(requestCode, resultCode, data);

    if (data != null) {
        if (requestCode == 2) {
            if (data.getParcelableExtra("BitmapImage") != null) {
                img.setVisibility(View.VISIBLE);
                img.setImageBitmap((Bitmap) data
                        .getParcelableExtra("BitmapImage"));
            }

            if (data.getStringExtra("BarcodeFormate") != null
                    && !TextUtils.isEmpty(data
                    .getStringExtra("BarcodeFormate"))) {
                bBarcodeFormate.setVisibility(View.VISIBLE);
                bBarcodeFormate.setText("Barcode Formats " + data
                        .getStringExtra("BarcodeFormate"));
            }

            if (data.getStringExtra("Type") != null
                    && !TextUtils.isEmpty(data.getStringExtra("Type"))) {
                bType.setVisibility(View.VISIBLE);
                bType.setText("Type " + data.getStringExtra("Type"));
            }

            if (data.getStringExtra("DateFormate") != null
                    && !TextUtils.isEmpty(data
                    .getStringExtra("DateFormate"))) {
                bDateFormate.setVisibility(View.VISIBLE);
                bDateFormate.setText("Date Formate " + data.getStringExtra("DateFormate"));
            }

            if (data.getStringExtra("MetaData") != null
                    && !TextUtils.isEmpty(data.getStringExtra("MetaData"))) {
                bmetaDataText.setVisibility(View.VISIBLE);
                bmetaDataText.setText("MetaData " + data.getStringExtra("MetaData"));
            }

            if (data.getStringExtra("DisplayContents") != null
                    && !TextUtils.isEmpty(data
                    .getStringExtra("DisplayContents"))) {
                dDisplayContents.setVisibility(View.VISIBLE);
                dDisplayContents.setText("Display Contents " + data
                        .getStringExtra("DisplayContents"));
            }
        }
    }
}

If you have any doubt or issue let me know.

by this you have no need install third party app for bar code scanner

Hitesh Bhalala
  • 2,872
  • 23
  • 40
  • work this code with min. sdk 15? what do you mean with "add barcode scanner" i have downloaded this files. and now? :( – Trombone0904 Dec 08 '15 at 07:38