简体   繁体   English

ZXing条码扫描器读取巴西条码

[英]ZXing barcode scanner to read Brazilian barcode

I'm aware that there is another post with the same topic here in the forum, but I coulnd't solve my problem and I've tried everything and it doesn't work. 我知道论坛上还有另外一个主题相同的帖子,但是我无法解决我的问题,我已经尝试了所有方法,但它不起作用。

Here is the thing, I've tried to make barcodeScanner, from ZXing, to read barcode format interleaved 2 of 5 , in an android I'm developing, but it doesn't work. 这是东西,我尝试使ZXing的条形码扫描仪在我正在开发的Android中读取交错的条形码格式(共5个,共2个),但这是行不通的。 The Scanner keep with the red light in the screen but doesn't read the bar code at all. 扫描仪在屏幕上一直显示红灯,但根本不读取条形码。

I'm using the "android-integration-2.3.0.jar", downloaded from here http://mvnrepository.com/artifact/com.google.zxing/android-integration/2.3.0 , but it doesn't read my bar code at all. 我正在使用从此处http://mvnrepository.com/artifact/com.google.zxing/android-integration/2.3.0下载的“ android-integration-2.3.0.jar”,但看不到我的条形码。 I'm sure that the problem is not with my barcode, it's an official one from a famous bank here. 我敢肯定问题不在于我的条形码,这是来自著名银行的官方代码。 This is the tutorial that I've followed : http://techiedreams.com/android-zxing-barcode-scanner-integration/ 这是我遵循的教程: http : //techiedreams.com/android-zxing-barcode-scanner-integration/

Anyway, let me show you some code: this is how I'm invoking the barCodeScanner 无论如何,让我向您展示一些代码:这就是我调用barCodeScanner的方式

ImageView ivBarCode = (ImageView) findViewById(R.id.ivPagamentosCodBar); ImageView ivBarCode =(ImageView)findViewById(R.id.ivPagamentosCodBar); ivBarCode.setOnClickListener(new View.OnClickListener() { ivBarCode.setOnClickListener(new View.OnClickListener(){

        @Override
        public void onClick(View v) {
            Intent intent = new Intent("com.google.zxing.client.android.SCAN");
            intent.putExtra("SCAN_FORMATS", "AZTEC,CODABAR,CODE_39,CODE_93,CODE_128,DATA_MATRIX,EAN_8,EAN_13,ITF,MAXICODE,PDF_417,QR_CODE,RSS_14,RSS_EXPANDED,UPC_A,UPC_E,UPC_EAN_EXTENSION");
            startActivityForResult(intent, 0);
        }
    });

and This is how i'm reading the information: or at least, think it should work: 这就是我阅读信息的方式:或者至少认为它应该起作用:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
//      if (data == null) {
//          ringProgressDialog.dismiss();
//          return;
//      }else 
        if (requestCode==IntentIntegrator.REQUEST_CODE)
        {
            IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
            if (scanResult != null)
            {
               String codBar = scanResult.toString();
               Toast.makeText(PagamentosContas.this, codBar, Toast.LENGTH_LONG).show();
               Log.e("Código de Barras",codBar);
               Log.e("Código de Barras",codBar);
               Log.e("Código de Barras",codBar);

            }
            else
            {
                // else continue with any other code you need in the method
               Toast.makeText(PagamentosContas.this, "scanResult is null.",     Toast.LENGTH_LONG).show();
            }
    }
//      else{
//      String valor = data.getStringExtra("valor");
//      valor = valor.replace(",", ".");
//
//      pagamento.setValorConta(valor);
//      ThreadPagamentosContas thread1 = new ThreadPagamentosContas();
//      thread1.start();
//      ringProgressDialog.dismiss();
//      }

    }

it doesn't read any barcode at all, or when it does, do it wrong, took an interleaved 2 of 5 by an EAN3... 它根本不读取任何条形码,或者读取时完全不对,用EAN3读取了5个交错的2个...

here is an example of an official barcode: https://drive.google.com/file/d/0ByQMtFUGwDRBWnZObkFBcDR1RVk/edit 以下是官方条形码的示例: https : //drive.google.com/file/d/0ByQMtFUGwDRBWnZObkFBcDR1RVk/edit

thanks in advance. 提前致谢。 this is driving me crazy for months now... 这让我快疯了几个月了...

I've found the problem! 我发现了问题! Everything on the tutorial is right and works fine. 教程中的所有内容都是正确的,并且可以正常运行。 The problem was the camera of ALL devices I have for testing. 问题是我要测试的所有设备的相机。

Last week I've got a better smartphone, with better resources and it reads the barcode just fine. 上周,我有一部性能更好的智能手机,拥有更好的资源,它可以很好地读取条形码。 Tablets usually don't have an autofocus tool in the camera hardware, so it cannot focus the barcode properlly. 平板电脑通常在相机硬件中没有自动对焦工具,因此无法正确对焦条形码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM