我正在通过 ZXIng IntentIntegrator 使用 QR 码扫描仪制作应用程序。我可以使用以下代码来实现
IntentIntegrator integrator = new IntentIntegrator(
HomeActivity.this);
integrator.initiateScan();
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
IntentResult scanResult = IntentIntegrator.parseActivityResult(
requestCode, resultCode, intent);
if (scanResult != null) {
// handle scan result
Toast.makeText(getApplicationContext(),
"scan " + scanResult.getContents(), 1).show();
}
// else continue with any other code you need in the method
}
它在真实设备上运行。但是当我尝试在我的其他设备上运行它时(三星注 2)。它给了我崩溃日志。
03-06 19:10:19.940: E/AndroidRuntime(10325): FATAL EXCEPTION: main
03-06 19:10:19.940: E/AndroidRuntime(10325): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.aztecbarcodereader.zxing.client.android.SCAN cat=[android.intent.category.DEFAULT] flg=0x4080000 }
03-06 19:10:19.940: E/AndroidRuntime(10325): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1580)
03-06 19:10:19.940: E/AndroidRuntime(10325): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1431)
03-06 19:10:19.940: E/AndroidRuntime(10325): at android.app.Activity.startActivityForResult(Activity.java:3446)
03-06 19:10:19.940: E/AndroidRuntime(10325): at android.app.Activity.startActivityForResult(Activity.java:3407)
03-06 19:10:19.940: E/AndroidRuntime(10325): at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817)
03-06 19:10:19.940: E/AndroidRuntime(10325): at com.aztecbarcodereader.zxing.integration.android.IntentIntegrator.startActivityForResult(IntentIntegrator.java:290)
03-06 19:10:19.940: E/AndroidRuntime(10325): at com.aztecbarcodereader.zxing.integration.android.IntentIntegrator.initiateScan(IntentIntegrator.java:274)
03-06 19:10:19.940: E/AndroidRuntime(10325): at com.aztecbarcodereader.zxing.integration.android.IntentIntegrator.initiateScan(IntentIntegrator.java:209)
03-06 19:10:19.940: E/AndroidRuntime(10325): at com.raa.jwelarydemo.HomeActivity$8.onClick(HomeActivity.java:241)
03-06 19:10:19.940: E/AndroidRuntime(10325): at android.view.View.performClick(View.java:4223)
03-06 19:10:19.940: E/AndroidRuntime(10325): at android.view.View$PerformClick.run(View.java:17275)
03-06 19:10:19.940: E/AndroidRuntime(10325): at android.os.Handler.handleCallback(Handler.java:615)
03-06 19:10:19.940: E/AndroidRuntime(10325): at android.os.Handler.dispatchMessage(Handler.java:92)
03-06 19:10:19.940: E/AndroidRuntime(10325): at android.os.Looper.loop(Looper.java:137)
03-06 19:10:19.940: E/AndroidRuntime(10325): at android.app.ActivityThread.main(ActivityThread.java:4898)
03-06 19:10:19.940: E/AndroidRuntime(10325): at java.lang.reflect.Method.invokeNative(Native Method)
03-06 19:10:19.940: E/AndroidRuntime(10325): at java.lang.reflect.Method.invoke(Method.java:511)
03-06 19:10:19.940: E/AndroidRuntime(10325): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
03-06 19:10:19.940: E/AndroidRuntime(10325): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
03-06 19:10:19.940: E/AndroidRuntime(10325): at dalvik.system.NativeStart.main(Native Method)
为什么我会收到此异常?
当我尝试在此设备上使用任何市场应用程序使用条形码时,还有一件事它也有同样的问题。我想我必须在我的特定设备上进行一些设置。但我找不到解决方案。