Android Zxing中如何调用ExpandedProductResultParser

发布于 2024-12-31 23:09:28 字数 986 浏览 1 评论 0原文

我有一个条形码扫描仪应用程序,它是基于出色的 Zxing 库构建的。我想知道是否可以通过在 android 活动中调用 ExpandedProductResultParser 等来使用 getLotNumber 方法。如果是,如何?

“Zxing 条码应用程序中出现相机错误” - 这是我基于 Zxing 构建的应用程序。

现在我想从条形码中提取批号。我在 onActivityResult() 中尝试过:

 String contents = intent.getStringExtra("SCAN_RESULT");
            //String format = intent.getStringExtra("SCAN_FORMATS");  

               Bundle bar=intent.getExtras();  

                System.out.println("Bundleeeeeeeeeeeeeeeeee :::::::::::" + bar );  

                String format = intent.getStringExtra("SCAN_RESULT_FORMAT");  
                System.out.println("Formaattttttttttttttt " + format);  





                Result result=new Result(contents, null, null, BarcodeFormat.CODE_128);  

                ResultParser.parseResult(result);  


            //ExpandedProductResultParser

在这里,我如何传递从 Result() 中的条形码捕获的实际格式?
另外我如何利用 ExpandedProductResultParser.parse() 获取lotNumber的方法?

谢谢
斯内哈

I have a Barcode scanner application which is built upon the great Zxing library. I wanted to know if I can make use of getLotNumber method by calling ExpandedProductResultParser etc in android activity. If yes, How?

"Getting Camera error in Zxing Barcode Application"
- this is the application i have built on based Zxing.

Now I want to extract Lot Number from the BarCode. What I have tried is this in onActivityResult() :

 String contents = intent.getStringExtra("SCAN_RESULT");
            //String format = intent.getStringExtra("SCAN_FORMATS");  

               Bundle bar=intent.getExtras();  

                System.out.println("Bundleeeeeeeeeeeeeeeeee :::::::::::" + bar );  

                String format = intent.getStringExtra("SCAN_RESULT_FORMAT");  
                System.out.println("Formaattttttttttttttt " + format);  





                Result result=new Result(contents, null, null, BarcodeFormat.CODE_128);  

                ResultParser.parseResult(result);  


            //ExpandedProductResultParser

Here, how can i pass actual format that is captured from barcode in Result()?
Also how can i make use of ExpandedProductResultParser.parse()
method to get lotNumber?

Thanks
Sneha

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

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

发布评论

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

评论(1

草莓酥 2025-01-07 23:09:28

你在使用意图吗?是的,只需使用返回的 String 上的类来解析它即可。有什么问题吗?

Are you using Intents? Yes, just use the class on the String you get back to parse it. What's the issue?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文