Zxing 条码相机选项
我想将 zing 条码扫描仪集成到我的 Android 应用程序中。所以我使用了 zing Integrator,如下所示
public Button.OnClickListener mScan = new Button.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.setPackage("com.google.zxing.client.android");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
}};public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
String contents = intent.getStringExtra("SCAN_RESULT");
String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
// Handle successful scan
} else if (resultCode == RESULT_CANCELED) {
// Handle cancel
}
}
}
我想在包含两个摄像头的 Android 平板电脑(2.2 版本)中实现此应用程序。 当我启动此功能时,它会自动开始使用后置摄像头(主)执行扫描,但根据我的应用程序需求,我需要仅使用前置摄像头执行条码扫描。是否有类似的选项
intent.putExtra("SCAN_MODE", "QR_CODE_MODE","FRONT_CAMERA");
- 可以借助此 zingintegrator 功能来启用前置摄像头?如果没有,我是否需要实现整个 zing 开源代码,这样是否可以仅使用前置摄像头执行扫描。谢谢。
I want to integrate the zing barcode scanner to my android application. so i used zing integrator as follows
public Button.OnClickListener mScan = new Button.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.setPackage("com.google.zxing.client.android");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
}};public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
String contents = intent.getStringExtra("SCAN_RESULT");
String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
// Handle successful scan
} else if (resultCode == RESULT_CANCELED) {
// Handle cancel
}
}
}
i would like to implement this application in android tablet (2.2 version) which contains two cameras.
when i start this function, this automatically starts performing scan with back camera(Main), but according to my application needs, i need to perform the barcode scanning using only front camera. is there option something like
intent.putExtra("SCAN_MODE", "QR_CODE_MODE","FRONT_CAMERA");
- is this possible to enable front camera with help of this zingintegrator function? if not, do i need to implement the whole zing open source code, so will it be possible to perform the scanning with only front camera. Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,真的没有人支持这一点。请求前置摄像头的 API 直到 Android 2.3 才出现(我想?),条码扫描仪现在是 1.5,很快就会转向 2.1。
Camera.open()
默认打开后置摄像头,不会选择前置摄像头。条码扫描仪确实有一个反转摄像头图像的选项,因为我们被告知至少有一台平板电脑只有有前置摄像头,并且为了使任何工作正常工作,您需要反转图像。
我可以告诉你,设备上的前置摄像头总体上比后置摄像头差得多。它的分辨率和 CCD 响应能力使其很难以这种方式进行扫描。
No, there's no support for this, really. The APIs for requesting the front camera did not appear until Android 2.3 (I think?) and Barcode Scanner is on 1.5 right now, moving to 2.1 soon.
Camera.open()
opens the rear camera by default and will not select the front camera.Barcode Scanner does have an option to reverse the camera image, since we're told that at least one tablet only has a front camera, and for anything to work you need to reverse the image.
I can tell you that the front camera on devices is much worse than the rear camera in general. its resolution and CCD responsiveness make it hard to scan this way.