I’m really new in Android Development and, like many others, I’m trying desperately to integrate ZXing into my project. I have to make a stand-alone QR scanning application for Android. (I’m using the 2.3.3 sdk).
I have to explain that I’ve already tried to find a solution to my problem by reading all the answers about the topic but I haven’t suceed at all.
Here is what I’ve done:
-
I downloaded the ZXing 2.0 Release from here
-
Then, I added the assets, src and res to my project simply by dragging the files into my
project. -
I referenced the core.jar archive located in the “core” folder by right-clicking in my
project > Build Path > Configure Build Path. I add ir as an External JAR.
This is a image to ilustrate.
-
In here, I was getting some errors in the ID’s and some other resources. That was
happening because I was referencing to que wrong R.java, so I solved that by changing “import com.google.zxing.client.android.R” to “import com.android.novaqr.R”, which is my projects
package. -
Then I added:
<uses-permission android:name="android.permission.CAMERA"/>
and
<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>
to the AndroidManifest.xml
So now I have no errors in my code and here is where i need help: I need the phone to scan when I push a button. I’ve tried a lot of solutions that I saw on the other questions about this topic, but I haven’t succeed.
I hope I’m clear with my question, if not, let me know and I’ll try to be more specific
Any help will be really apreciated.
You are strongly discouraged from completely copying and pasting our app. It sounds like you’re not experienced enough in Android to use it this way anyway.
Instead, you can use the app’s scanning service by Intent, which is far easier and supported: http://code.google.com/p/zxing/wiki/ScanningViaIntent