I successfully integrated ZXing Library in my app, but there is a weird problem that I am encountering during scanning.
As you can see here
I am able to center the Scanning area to my custom view by passing the canvas width and height to the CameraManager Class Like this, so I can set the preview size and location to where I want it to be.
public void onDraw(Canvas canvas) {
int width = canvas.getWidth();
int height = canvas.getHeight();
//give the framing preview the canvas width and size
CameraManager.get().giveCanSize(width, height);
//Some more code
But the problem now is, If I place a barcode image in the CENTER or LEFT part of the viewfinder (The clear area surrounded by darkened borders) , it does not scan it, Like it does not see it, BUT, whenever I place the barcode image on the RIGHT portion of the view finder, it scans it. Can someone tell me where did I mess up? or did I miss something?
some part of the modified framingRect method
//modified framing rectangle, depends entirely on the canvas size
int left = (canvasWidth / 2) - (width / 2);
int top = (canvasHeight / 2) - (height / 2);
int right = (canvasWidth / 2) + (width / 2);
int botm = (canvasHeight / 2) + (height / 2);
framingRect = new Rect(left, top, right, botm);
Log.d(TAG, "Calculated framing rect: " + framingRect);
}
return framingRect;
I hope someone can help me, TIA!