Reputation: 48
I am delevoping an android app and my main class code is like this.
But it shows error before starting camera. How can I solve this?
public void onClick(View view) {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_FORMATS", "CODE_39,CODE_93,CODE_128,DATA_MATRIX,ITF,CODABAR");
startActivityForResult(intent, 0); //Barcode Scanner to scan for us
}
});
AND THIS IS MY STACKTRACE
09-02 13:54:51.659 20660-20660/com.mehdi.BarCodeScanner I/ViewRootImpl﹕ ViewRoot's Touch Event : Touch Down
09-02 13:54:51.739 20660-20660/com.mehdi.BarCodeScanner I/ViewRootImpl﹕ ViewRoot's Touch Event : Touch UP
09-02 13:55:06.919 20660-20660/com.mehdi.BarCodeScanner D/AndroidRuntime﹕ Shutting down VM
09-02 13:55:06.919 20660-20660/com.mehdi.BarCodeScanner W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41813e48)
09-02 13:55:06.949 20660-20660/com.mehdi.BarCodeScanner E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.mehdi.BarCodeScanner, PID: 20660
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.google.zxing.client.android.SCAN }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1632)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
at android.app.Activity.startActivityForResult(Activity.java:3468)
at android.app.Activity.startActivityForResult(Activity.java:3429)
at com.mehdi.BarCodeScanner.main$2.onClick(main.java:106)
at android.view.View.performClick(View.java:4442)
at android.view.View$PerformClick.run(View.java:18473)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5105)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
at dalvik.system.NativeStart.main(Native Method)
Upvotes: 2
Views: 829
Reputation: 152777
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.google.zxing.client.android.SCAN }
You need to install the ZXing application before trying to use it via Intent
.
Consider using the IntentIntegrator
approach to automate checking for and installing the ZXIng app.
Upvotes: 1