I want to use zxing in an android project. I have download the code and the example app is running now (ZXingTestActivity). For your information, i am not very familiar with coding native android.
I want to use zxing to scan qr-codes to configurate an application. To avoid confusion between normal qrcodes and configuration qrcodes i want to print inverted/negative qrcodes on screen or paper.
To be able to scan these inverted/negative qrcodes, the camera must be in negative mode. How can i do this? I am not sure where to start, however....
In the ZXingTestActivity.java there is a clicklistener that specify some extra parameters to the IntentIntegrator, for example:
private final Button.OnClickListener scanProduct = new Button.OnClickListener() {
@Override
public void onClick(View v) {
IntentIntegrator integrator = new IntentIntegrator(ZXingTestActivity.this);
integrator.addExtra("SCAN_WIDTH", 800);
integrator.addExtra("SCAN_HEIGHT", 200);
integrator.addExtra("RESULT_DISPLAY_DURATION_MS", 3000L);
integrator.addExtra("PROMPT_MESSAGE", "Custom prompt to scan a product");
integrator.initiateScan(IntentIntegrator.PRODUCT_CODE_TYPES);
}
};
Is it possible to add camera settings with addExtra and how do i format this? Is it possible? Or is there another way to configurate the camera to inverted/negative mode?
I do not know if it completely impossible with ZXing but with ZBar it is possible!
First download the ZBar android version on sourceforge: http://sourceforge.net/projects/zbar/files/AndroidSDK/
Add project to eclipse
Open CameraPreview.java
Add a private var to the class:
private Camera.Parameters mCameraParams;
Add the following lines after the line: mCamera = camera;
in the constructor CameraPreview:
mCameraParams = camera.getParameters(); mCameraParams.setColorEffect(Camera.Parameters.EFFECT_NEGATIVE); mCamera.setParameters(mCameraParams);
That's it! (run the project)
Also think that ZBar is faster to detect damaged barcodes. Is the same as the PC-version i have used in another project and does the job very well. Blink with your eyes and the code is there. No fancy things at all, just good!