New issue 925 by rocket18...@gmail.com: Scanner rectangle not centered
http://code.google.com/p/zxing/issues/detail?id=925
IMPORTANT: Please don't ask questions by filing bugs. Instead, send an
email to zx...@googlegroups.com.
What steps will reproduce the problem?
1.Using zxing 1.7 source code
2.
3.
What is the expected output? What do you see instead?
Expected output: The viewfinder in the device's screen that shows the
scanner input.
Instead: I can see the viewfinder but the rectangle is not centered, I
haven't modified anything to the source code and the rectangle shows in one
of the device's screen corner (bottom, left) even using the emulator.
However the text that says "Place a barcode inside the viewfinder..." is
centered.
What version of the product are you using? On what operating system?
1.7, android 2.2
Please provide any additional information below.
How can I center the rectangle, because neither using the emulator nor my
device (Xperia X10) the viewfinder's rectangle appears in the center. Any
help would be much appreciated. Thanks in advance.
This has always been due to the device misreporting its preview size, I
think. So I'd suspect that is also an issue here. However if you have
access to the dev tools and debugger it would be very useful to see what
figures it's returning for the camera and screen size. That would point out
the root of the problem.
I did observe this issue and restarted the device whereupon the square was
centered. I think its' a problem with the device orientation as the square
would have been perfect if the layout were reversed.
I've tried many times and the rectangle never appeared centered. I attach
an image showing how the viewfinder displays using the emulator.
In my real device a Xperia X10 with android 2.2 the viewfinder displays in
exact the same way, that is not centered.
Thanks for your help.
Attachments:
Untitled.png 89.3 KB
Comment #4 on issue 925 by sro...@gmail.com: Scanner rectangle not centered
http://code.google.com/p/zxing/issues/detail?id=925
(No comment was entered for this change.)
i am also facing the problem of centered rectangle.
How to resolve this.
Thanks in advance
You might try the latest build which has a workaround for some devices,
which might address this.
I may try with the latest build.
Can you tell me what changes are there so I can try manually make the
changes to support this issue
I'm thinking of this bit in CameraConfigurationManager.java:
// We're landscape-only, and have apparently seen issues with display
thinking it's portrait
// when waking from sleep. If it's not landscape, assume it's mistaken
and reverse them:
if (width < height) {
Log.i(TAG, "Display reports portrait orientation; assuming this is
incorrect");
int temp = width;
width = height;
height = temp;
}
Does this mean that i have to change the above mentioned condition to
width > height
No, why?
I was asking because I am not able to center the scan rectangle.
... and you asked if there were changes that might address that, and that's
what I posted.
currently me working on 1.7 release for android, and here I dont get the
scan rectangle in center.
i tested this on many phones of different screen resolution but gets the
same rectangle box at the top right corner of screen.
This issue has not been solved in 2.0
I am still getting a surface in right top corner instead of center.
how do i solve this???
You'd have to post any information to help. It certainly does work on every
device I know of, and has been fixed even for the devices with bugs in this
thread.
I am using Samsung Tab and requires the applicaton to run on all android
devices.
also scanning is critical operation of my device
I have solved the issue with replacing the way that the height and width
are determined:
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
float density = metrics.density;
int width = Float.valueOf(metrics.widthPixels / density).intValue();
int height = Float.valueOf(metrics.heightPixels /
density).intValue();
This will accomodate the density of the screen which can be different for
each device and the width and height reported by the phone are relative to
this density.
For example the samsung galaxy SII reports dimensions 800x600 and density
1.5 and the Samsung Galaxy Y reports dimensiions 320x240 and density 0.75.
Note: The original method used (display.getWidth() and display.getHeight())
are deprecated for usage and will never work on the latest android versions
(higher then 13).
By the way, the change is in the CameraConfigurationManager or you can pass
then in the intent.
These methods are not deprecated in the version of Android this app
supports, which is 2.1+. They do work as before on API 13+. They are merely
deprecated.
The density is irrelevant here -- it's sizing dimensions in pixels based on
pixels available. For example, the Galaxy Y really has a 320x240 screen. If
you considered it to have otherwise, this would not work.
i am not sure therefore why your change happens to work for you, but it
does not work on other devices.
These methods are not deprecated in the version of Android this app
it works fime for small screen resolution but for larger screen size like
Tablet, its does not adjust the view.
Nope, it works on tablets too. I have 2 of them. I really am struggling to
find actionable information here.
How to rotate the view,, as in the scanned barcode it rotated by 90
degree...
and do need to do any changes to support it for tablet...can u give the
entire source code of the class or the concerned method...