I have added core jar file of ZXing according to post Integrating the ZXing library directly into my Android application
in my application i'm trying to create an intent that starts the QR reader according to post QR code scanner
But i can not fin开发者_如何学God the CaptureActivity class in the core.jar?
How can I read QR code within my application without using any external application?
Thanks, Eyal.
CaptureActivity should be there, it's just that you still have to add it to AndroidManifest.xml if you want to run it because that won't carry over from the jar. Add this XML
<activity android:name="com.google.zxing.client.android.CaptureActivity"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<intent-filter>
<action android:name="com.google.zxing.client.android.SCAN"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
Reference: http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/
(Yes, I have tried this myself)
also make sure you have
<uses-permission android:name="android.permission.CAMERA"/>
You're doing everything right -- except that you should not be using CaptureActivity
. It's not found since it's not part of the core/
library, but rather part of android/
, which is the source for our app, Barcode Scanner. I'd suggest not reusing our code quite that directly, since you will have to copy a lot to get it to work, and most people who go this route just copy nearly everything, and that's not OK.
You need to write your own application. See how the code in android/
calls the core library for decoding in DecodeHandler
. You can look at our AndroidManifest.xml
to see how to declare your intents. You do not need to, and should not, copy our CaptureActivity
. It's there for good ideas, not cloning.
精彩评论