Zxing条码扫描码
谁能给我解释一下下面的代码吗?
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
startActivityForResult(intent, 0);
在 Intents.java 中的 zxing 条码扫描器代码中(如上)。意图将调用哪个活动等等?
提前致谢
Can anyone explain to me the following code?
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
startActivityForResult(intent, 0);
In the zxing barcode scanner code in Intents.java (like the above). The intent will call which activity and so on?
Thanks in Advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在提出该特定操作的意图 (
com.google.zxing.client.android.SCAN
)。zxing 的条形码扫描仪应用程序将一个活动与该操作注册为意图过滤器,因此 Android 知道如何解析该操作的意图并将其链接到该活动。
当您执行该意图时,它将在 zxing 应用程序中打开该特定活动。当此活动完成时,它将把控制权连同结果返回给您的活动。您需要在
onActivityResult
回调。You are raising an intent for that specific action (
com.google.zxing.client.android.SCAN
).The barcode scanner application by zxing registers an activity with that action as an intent filter, so Android knows how to resolve intents for that action and links them to that activity.
When you execute that intent, it will open that specific Activity in the zxing application. When this activity finishes it will return control to your Activity with the result. You need to handle this in the
onActivityResult
callback.