Can i limit the reading area?
Is there any way I can use the full screen camera area to display but limit the reading area to a subview?
Yes. The reading area is your SurfaceView, so how you size it (be it full screen or a specific height and width) in your layout is on you. Next is where you display your read data into , again depends on where you show the read data.
I may be able to answer more clearly if you gave me a specific case.
Hi, I'm sorry I lated too much to answer but I've been a little busy. What I was trying to say is that I wanted to show the camera on the whole screen but limit the qr reading area to another inside view, like this:

I ended up modifying your QRDataListener by adding another onDetected method that sends the whole Barcode object so i could get the Rect of the read data and compare it to the Rect of my inside view in order to limit the reading area.
QRDataListener:
public interface QRDataListener {
/**
* On detected.
*
* @param data
* the data
*/
// Called from not main thread. Be careful
void onDetected(final String data);
// Allows to use the whole captured data
void onDetected(final Barcode data);
}
QREader:
@Override
public void receiveDetections(Detector.Detections<Barcode> detections) {
final SparseArray<Barcode> barcodes = detections.getDetectedItems();
if (barcodes.size() != 0 && qrDataListener != null) {
qrDataListener.onDetected(barcodes.valueAt(0));
qrDataListener.onDetected(barcodes.valueAt(0).displayValue);
}
}
My implementation:
...
qReader = new QREader.Builder(ScanActivity.this, scanner, new QRDataListener() {
@Override
public void onDetected(final String data) {
}
@Override
public void onDetected(Barcode barcode) {
if(areaRect.contains(barcode.getBoundingBox())) {
final String data = barcode.displayValue;
qReader.stop();
...
}
}
}).facing(QREader.BACK_CAM)
.enableAutofocus(true)
.height(width)
.width(height)
.build();
...
I hope this could help somebody else and I thank you for your attention.
@primissus if you added a feature, do consider sending a PR.
I am facing a problem on the aspect ratio of the camera preview. Always displayed with bad aspect ration. What to do ??
@simonkarmy I am facing same issue too. did you get any solution for that?