AdamM
AdamM

Reputation: 162

Pare ZXing down to bare minimum

I am working on using the ZXing project to scan either a Data Matrix or QR code for our company's internal use and get the string back from the code.

I am doing this using an Android application, based off the source project on the site.

What I need from this is to throw out a large amount of the code to pare the project to a bare minimum necessary for this, as we are looking to just use it for the one purpose.

I have an application setup that uses a Surface Holder to get the QR code or Data Matrix in a picture. Is there a way to send that into the decoding in the core.jar file and get the string back?

Basically, I want to just decode my image without continuously scanning it, by taking one good picture and decoding it.

Any advice on a better way to accomplish my goal would work as well. This application should hopefully support back to API 11, but can adjust if necessary.

EDIT

To clarify, my main problem is getting an image to be decoded. I cannot seem to find how to call into the core.jar to decode the code once I have it.

Upvotes: 0

Views: 188

Answers (2)

Sean Owen
Sean Owen

Reputation: 66886

If you're just looking for what bit of the code does the decoding from an image, it's:

https://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/DecodeHandler.java#77

You can make it simpler even. Of course you will be loading an image from elsewhere it seems but the call to the core is just about the same few lines.

Upvotes: 0

Stefano Sanfilippo
Stefano Sanfilippo

Reputation: 33046

Instead of stripping what is not needed before, develop your application and have Proguard remove unneeded bytecode at build time.

From Proguard description:

ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. It detects and removes unused classes, fields, methods, and attributes. It optimizes bytecode and removes unused instructions.

However, check if this is compliant with ZXing license, this wiki page contains all the relevant details.

Upvotes: 1

Related Questions