Question

I see this debug message frequently in LogCat. When doing swipe or rotating the device for example. The emulator doesn't react to the events then. What does it mean?

In need to test rotation on the emulator but on some versions, when I press CTRL F12 or CTRL F11 nothing happens (well, the device rotates as a whole but not the screen) and I see this message in log. I don't find anything with google either...

Ok, it's PhoneGap specific. I found something in the source code of PhoneGap:

 /**
  * We are providing this class to detect when the soft keyboard is shown 
  * and hidden in the web view.
  */
 class LinearLayoutSoftKeyboardDetect extends LinearLayout {

        private static final String TAG = "SoftKeyboardDetect";

But I'm not doing anything with soft keyboard, I'm just rotating the device. It's a bug maybe?

Was it helpful?

Solution

I can give you the background on this log. There is a bug in Android or maybe they'd call it a lack of feature but there is no event thrown when the keyboard is shown or goes away. This causes a problem for web applications as the keyboard shortens the the screen size. When the screen size becomes smaller then your UI suffers.

In order to be able to react to the keyboard show/hide in PhoneGap Android we implemented the LinearLayoutSoftKeyboardDetect which is basically a LinearLayout but it reacts to changes in the screen size. If you rotate the device the width becomes the height and we can ignore the change but if the height gets dramatically smaller while the width remains the same it is safe to assume there is a keyboard being shown and we throw a show keyboard event. When the height gets dramatically larger while width stays the same we throw a hide keyboard event. Make sense?

OTHER TIPS

This implementation seems affect with the situation -> When native keyboard is pop up it shrink the webview in phonegap. Again demention changes. So it tends to ignore necessary events. I want to detect native keyboard done button press event.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top