6

我已经使用 Zxing 库使用 Intent 制作了二维码扫描仪,并且我将库保存在应用程序中,这样我的应用程序就不再需要条形码扫描仪。但是当条形码扫描仪已经在操作系统中时,当我启动我的应用程序时,会出现一个对话框,询问使用:条形码扫描仪或我的应用程序的完整操作。当我在自己的应用程序中拥有所有库时,我该如何避免这个对话框。请帮帮我。

示例代码:

Intent in = new intent("com.google.zxing.android.SCAN");

4

2 回答 2

7

要使用:

Intent intent=new Intent("com.google.zxing.client.android.SCAN");
intent.setClassName("com.google.zxing.client.android", "com.google.zxing.client.android.CaptureActivity");
startActivityForResult(intent, 0);

或者:

Intent intent=new Intent("com.google.zxing.client.android.SCAN");
intent.setClassName(this, "com.google.zxing.client.android.CaptureActivity");
startActivityForResult(intent, 0);
于 2010-12-10T03:24:32.973 回答
0

Better still is to use the IntentIntegrator class provided by the project: http://code.google.com/p/zxing/wiki/ScanningViaIntent

This takes care of more cases (like the app not being installed) than just making your own Intent.

于 2013-01-23T22:28:43.887 回答