Zxing无法扫描代码128

时间:2016-06-01 12:03:13

标签: android zxing code128

我尝试编写以app128格式扫描代码的Android应用程序。

我使用支持它的Zxing库。

另一次扫描工作正常。

我使用此代码启动扫描程序:

Intent intent = new Intent("com.google.zxing.client.android.SCAN");
    //intent.putExtra("SCAN_MODE", "PRODUCT_MODE");
    intent.putExtra("SCAN_FORMATS", "CODE_128");
    startActivityForResult(intent, SCAN_TYPE_POSITION);

我做错了什么?

感谢您的回答

1 个答案:

答案 0 :(得分:0)

public void scanBar(View v) {
    try {

        //start the scanning activity from the com.google.zxing.client.android.SCAN intent
        Intent intent = new Intent(ACTION_SCAN);
        intent.putExtra("SCAN_FORMATS", "CODE_128");

        startActivityForResult(intent, 0);

    } catch (ActivityNotFoundException anfe) {

        //on catch, show the download dialog
        showDialog(Barcode2Activity.this, "Ñão foi encontrado scanner de código de barras", "Deseja realizar o Download?", "Sim", "Não").show();

    }
}