如何写在Android中使用zxing酒吧code扫描仪 [英] How to write a barcode scanner in Android using zxing

查看:146
本文介绍了如何写在Android中使用zxing酒吧code扫描仪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想酒吧,code集成scannerin我的Andr​​oid应用程序。

I want to integrate bar-code scannerin my Android application.

我尝试添加在 zxing 库,但我所有的应用程序确实是不显示的扫描摄影机视图。

I attempted to add the zxing library, but all my app does is show the camera view without scanning.

的http://$c$c.google.com/p/zxing/

有没有整合酒吧code扫描功能的简单方法?

Is there a simple way to integrate barcode scanning functionality?

推荐答案

这是waaaay太开放式的问题的。长期和短期的它是ZXing的Andr​​oid应用程序部分是一个位单芯片,除非你非常熟悉的话可能很难复制到现有的应用程序 - 其实我建议从斑马线源头开始,并获得该运行起来,然后黑客出来你不需要的部分和周围加入您的应用程序code到ZXing,符合而不是其他方式(改变包名和这样的,将您的活动清单等)。

This is waaaay too open-ended of a question. Long and short of it is that the Android app parts of ZXing are a bit monolithic and can be hard to copy into your existing app unless you're very familiar with it -- I'd actually suggest starting from the ZXing source and getting that up and running, then hacking out the parts you don't need and adding your apps code into ZXing, rather than the other way around (changing the package names and such, adding your activities to the manifest, etc.).

关键code你要开始改变在 CaptureActivity.java handleDe code / handleDe codeInternally 办法;这就是被调用时,扫描仪拿起一个有效酒吧code。

The key code you'll want to start changing is in CaptureActivity.java's handleDecode/handleDecodeInternally methods; that's what gets called when the scanner picks up a valid barcode.

一旦你更熟悉的源代码,你可以尝试把所有的核心 zxing类的JAR文件,因为你很少需要碰那些和他们经营合理独立Android应用部分(因为他们与其他非Android的Java版本zxing共享)。

Once you're more familiar with the source, you might try putting all the core zxing classes in a JAR file, since you'll rarely need to touch those and they operate reasonably independently of the Android app parts (since they're shared with the other non-Android Java zxing versions).

另外,一定要权衡每当有一个新的越野车设备出来,以保持你的ZXing code的不便 - 斑马线家伙做的工作自动为您如果你只是通过意图,而不是整合的复印其粘贴code。

Also, be sure to weigh the inconvenience of having to maintain your ZXing code whenever a buggy new device comes out -- the ZXing guys do that work for you automatically if you just integrate via the Intents instead of copy-pasting their code.

这篇关于如何写在Android中使用zxing酒吧code扫描仪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆