我的问题是,当扫描pdf417条码格式时,有时会根据扫描结果返回UPC_E格式吗?
这是我的代码片段
private BarcodeView barcodeView;
private BarcodeCallback callback = new BarcodeCallback() {
@Override
public void barcodeResult(BarcodeResult result) {
if (result.getText() != null) {
Toast.makeText(getActivity(), result.getText(), Toast.LENGTH_LONG).show();
}
}
@Override
public void possibleResultPoints(List<ResultPoint> resultPoints) {
}
};
这是图书馆
compile 'com.journeyapps:zxing-android-embedded:3.3.0'
最佳答案
这样就解决了问题。很久以前 :)
private BarcodeCallback callback = new BarcodeCallback() {
@Override
public void barcodeResult(BarcodeResult result) {
if (result.getText() != null) {
String barcodeResult = result.getText();
String barcodeFormat = result.getBarcodeFormat().toString();
if (barcodeFormat.equals("PDF_417")) {
try {
String barcodeEncodedResult = new ConvertUtil().encodeIntoBase64(barcodeResult);
processEncodedResult(barcodeEncodedResult);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
} else {
Toast.makeText(getActivity(), "Unable to read as PDF_417 barcode format", Toast.LENGTH_LONG).show();
}
}
}
关于java - Zxing嵌入式条形码阅读器使用(BarcodeView),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39197441/