android - 扫描二维码并显示它及其值(value)

标签 android android-camera zxing

我正在使用 Zxing Barcode scanner app 扫描条码使用

Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);

我可以在onActivityResult 中得到结果。我想显示QR 码的值和QR 码本身。 我无法弄清楚如何同时扫描和捕获 QR 码的图像。

有什么办法可以实现吗?

最佳答案

ZXing 在扫描时实际上并不拍照。它确实从相机馈送中“捕获”图像,但不会将任何内容保存到 SSD 卡或内存中。如果您使用他们在其网站上发布的 IntentIntegrator 代码进行扫描,您可以获得原始字节。

http://code.google.com/p/zxing/source/browse/trunk/android-integration/src/com/google/zxing/integration/android/IntentResult.java

您可以看到 IntentResult 具有原始字节。我不完全知道它是什么格式,但我打赌你可以将它传递给 Bitmap 以获取图像。

关于android - 扫描二维码并显示它及其值(value),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13041512/

相关文章:

Android:同时进行两项 Activity

android - 大多数二维码扫描器无法扫描 Android zxing 库生成的二维码

Android:如何在单选AlertDialog中设置选择?

android - glMapBufferRange() 使用 TrasnformFeedback 在 Android OpenGLES 3.0 中返回全零

android - 约束布局中的编辑文本滚动条问题

android - 将 zxing-2.0 实现到我的 android 应用程序中

android - 创建二维码并显示在 ImageView 中

android - 构建 DNS 查询并将其发送到特定的 DNS 服务器

android - 如何在 Android Camera Preview 中创建 Lomo/复古效果?

Android 相机预览帧时间戳