I try to use Zxing to decode 128C (Code set C) barcodes. I have success when I read other types like QR_CODE, UPC_A.
These are barcodes that I trying to read:
Is possible read 128C barcodes (Not CODE 128 pure) with Zxing ?
I try to use Zxing to decode 128C (Code set C) barcodes. I have success when I read other types like QR_CODE, UPC_A.
These are barcodes that I trying to read:
Is possible read 128C barcodes (Not CODE 128 pure) with Zxing ?
简短的回答,是的,应该是可能的。由于 128C 只是 128 的子集。可以扫描代码,可能需要几秒钟。并让 XZing 在应用程序中工作。
你发现支持128,现在你要做翻译。128C 采用与 128 相同的输入,只是输出数字。因此,您可以根据返回的数据进行翻译,并将其转换为 128C。检查第二个链接以了解其翻译方式。
https://github.com/zxing/zxing/blob/master/README.md
https://en.wikipedia.org/wiki/Code_128
从 XZing github 获取所需的类,将它们放在项目的 java 部分的包中。我只用了2个:
以下是它在我的代码中的启动方式:
/**
* Method called to intiate the scan (it's linked to a button)
*/
public void doScan(View view) {
IntentIntegrator scanIntegrator = new IntentIntegrator(this);
scanIntegrator.initiateScan();
}
// when you click the Scan Bar Code button
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanningResult != null) { // we have a result
String scanContent = scanningResult.getContents(); // set the content of the scan.
String scanFormat = scanningResult.getFormatName(); // set the type of scan.
// You will want to put this data somewhere else, globals, etc.
} else {
toast("No scan data received!"); // call to make a toast
}
}