ZXing & Android's software keyboard

201 views
Skip to first unread message

Ron DuPlain

unread,
Dec 19, 2010, 11:56:31 AM12/19/10
to zx...@googlegroups.com
Hi,

Has anyone run into layout issues in Android with zxing and the
software keyboard?

I have an Android project where I'm embedding ZXing in order to
customize the preview UI to spec. Everything works beautifully on the
HTC Magic and G1. Scanning functionality also works on a Droid or
Samsung Galaxy, but the app gets stuck if the custom CaptureActivity
is launched after an activity with EditTexts. Instead of the preview
screen, I see a window containing only the previous activity's
background and a TextView from capture.xml -- no camera preview
(though on the Droid you can hear the camera focusing). It's almost
as if Android stopped drawing the layout half way through.

On the emulator, I see the same behavior, but I can also see that
Android still has the software keyboard in focus. The suggestion text
view is still visible, but without any text. Any attempt to get rid
of the software keyboard is explicitly ignored (see "ignoring" request
in logs). The logs don't show any errors, but do suggest something's
out-of-place with the software keyboard (see below).

r1597 adds stateAlwaysHidden "to keep soft keyboard away" so maybe you
guys have run into this kind of issue before?

Thanks,

Ron


12-19 11:37:33.638: WARN/InputConnectionWrapper.ICC(115): Timed out
waiting on IInputContextCallback
12-19 11:37:34.128: INFO/InputConnectionWrapper.ICC(115): Got
out-of-sequence callback 65 (expected 66) in setCursorCapsMode,
ignoring.

Sean Owen

unread,
Dec 19, 2010, 1:34:13 PM12/19/10
to zx...@googlegroups.com
The suggested change came from a user -- I myself don't know anything about this one. But I bet he won't mind if I copy his original message in case it helps:


Great job on your app. However, I would like to suggest a minor
modification that would improve the user experience when your
com.google.zxing.client.android.SCAN activity is launched from another
application.

The com.google.zxing.client.android.SCAN activity should have the
stateAlwaysHidden flag for its windowSoftInputMode. Devices that don't
have a physical keyboard may have the soft keyboard displayed in another
application that launches the com.google.zxing.client.android.SCAN
activity. In that case, the soft keyboard obscures the scanning window and
the user must press back to see what they are scanning. You can see what
this is like by initiating a scan in your Barcode Scanner app (on a device
without a physical keyboard) and long-pressing the menu button.

Ron DuPlain

unread,
Dec 19, 2010, 5:12:36 PM12/19/10
to zx...@googlegroups.com
Thanks for the tip Sean.

As it turns out, the bug was caused by the background drawable of the
activity which launched the intent for CaptureActivity. Removing the
background drawable from the launching activity resolved the issue (I
assume the drawable is not scaling correctly). This was perplexing
since both hierarchyviewer and logcat were reporting nearly
identically across my broken CaptureActivity and BarcodeScanner 3.52.

Thanks for zxing - it rocks! git's rebase feature (using git-svn)
makes it easy to stay up-to-date with mainline development when
embedding zxing.

Ron

Reply all
Reply to author
Forward
0 new messages