0

我尝试编写以code128格式扫描代码的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);

我做错了什么?

谢谢你的回答

4

1 回答 1

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();

    }
}
于 2017-08-15T17:38:48.580 回答