Google ML套件,BarocodesCannerOptions动态添加条形码读取类型

发布于 2025-02-12 18:57:46 字数 796 浏览 1 评论 0原文

我添加了选择按钮。但是,我无法将数据传输到选项部分。 我的代码如下。如何以编程方式添加深色零件?

barcodescanneroptions options =新的barcodescanneroptions.builder() .setBarcodeFormats( settings.getBarcodeean13(),settings.getBarcodeean8() )。build();

public barcodescannerprocessor(上下文上下文,交易所canneddata fisshangescanneddata){ 超级(上下文);

在此处输入图像描述

    settings = new Settings(context);

    // Comment this code if you want to allow open Barcode format.
    BarcodeScannerOptions options = new BarcodeScannerOptions.Builder()
            .setBarcodeFormats(settings.getBarcodeEan13(),settings.getBarcodeEan8()).build();

    barcodeScanner = BarcodeScanning.getClient(options);

I added select buttons. However, I cannot transfer the data here to the options section.
my codes are as follows. How can I add the dark parts programmatically?

BarcodeScannerOptions options = new BarcodeScannerOptions.Builder()
.setBarcodeFormats(settings.getBarcodeEan13(),settings.getBarcodeEan8()).build();

public BarcodeScannerProcessor(Context context, ExchangeScannedData exchangeScannedData) {
super(context);

enter image description here

    settings = new Settings(context);

    // Comment this code if you want to allow open Barcode format.
    BarcodeScannerOptions options = new BarcodeScannerOptions.Builder()
            .setBarcodeFormats(settings.getBarcodeEan13(),settings.getBarcodeEan8()).build();

    barcodeScanner = BarcodeScanning.getClient(options);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧时模样 2025-02-19 18:57:46

一个解决方法是,您可以手动计算支持的格式。

int supportedFormats = 0
for each format from settings
  supportedFormats |= format
options = new BarcodeScannerOptions.Builder().setBarcodeFormats(supportedFormats).build()

One workaround is you can compute the supported formats manually.

int supportedFormats = 0
for each format from settings
  supportedFormats |= format
options = new BarcodeScannerOptions.Builder().setBarcodeFormats(supportedFormats).build()
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文