Zxing改变动作意图
我将 Zxing 库添加到我的 Android 应用程序中,但出现了问题。 当您已经安装了条形码扫描仪时,它会向您显示 带有弹出窗口。 我不希望这种情况发生并改变了操作意图。 这是有效的,但是当我第一次打开我的应用程序并选择 条形码扫描仪崩溃了。 当我第二次打开它时,一切正常。
有人可以帮我吗?
I added the Zxing library to my android app but there is a problem.
When you already have a bar code scanner installed it presents you
with a popup.
I don't want this to happen and changed the the action intent.
This is working, but when I open my app for the first time and select
the bar code scanner it crashes.
When I open it for the second time everything works fine.
Can anybody please help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经在邮件列表上回答过这个问题几次了。正如我所说,您需要注意
ActivityNotFoundException
。当你启动一个没有应用程序的意图时,Android 会抛出这个错误,这就是这里发生的情况。您需要自己处理这个问题,方法是捕获异常,也许还可以将用户发送到市场进行下载。
这正是
zxing
中android-integration
中的代码所做的,这就是为什么我也已经告诉你看一下它。I've already answered this a few times on the mailing list. As I said, you need to pay attention to
ActivityNotFoundException
.Android throws this when you start an intent for which there is no app, and that's what's happening here. You need to handle this yourself by catching the exception and, maybe, sending the user to Market to download.
This is exactly what the code in
android-integration
inzxing
does, which is why I also already told you to look at that.