This is a migrated thread and some comments may be shown as answers.

Detecting keyboard open/close

3 Answers 1225 Views
Google Android
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kjell
Top achievements
Rank 1
Kjell asked on 22 Aug 2014, 03:43 PM
In the past I was able to use the following code to detect the keyboard opening and closing:

document.addEventListener("showkeyboard", function(){ keyboardOpen();}, false);
document.addEventListener("hidekeyboard", function(){ keyboardClose();}, false);

But this is not working since updating to the newer Kendo libraries (I was on a pretty old version before, I think around 2013 Q2 or Q3).  

How should I go about detecting the opening/closing of the android keyboard?  I am testing on a samsung tablet.

3 Answers, 1 is accepted

Sort by
0
Kjell
Top achievements
Rank 1
answered on 22 Aug 2014, 03:52 PM
Never mind, I was binding the event listeners improperly.  Please ignore or delete this thread.
0
Pratik
Top achievements
Rank 1
answered on 26 Sep 2014, 11:19 AM
I remove `android:theme="@android:style/Theme.Black.NoTitleBar` from AndroiedManifest.xml but still i am not getting show keyboard and hide keyboard event.

i have set `android:windowSoftInputMode="adjustPan"` as i dont want to resize while inputting.

i am developing hybrid application using telrik appbuilder. i want to make scroll my screen when softkeyboard is visible.

when i set `android:windowSoftInputMode="adjustResize"` i get the keyboard hide and show event.but then my screen is resize when softkeyboard up. i dont want to do that.
this is my code:

       document.addEventListener("showkeyboard", function() {   
            
           alert("showkey");    

       }, false);
    
       document.addEventListener("hidekeyboard", function() {
              
           alert("hidekey");
               
       }, false);

is there any workaround or fix for this?
0
Tsvetina
Telerik team
answered on 29 Sep 2014, 02:47 PM
Hi Pratik,

This is a limitation specific to the Android platform when using the adjustPan mode. It has been explained by the Cordova team here:

Cordova don't trigger hidekeyboard or showkeyboard with adjustPan in the Android Manifest

You should rather use adjustResize mode and, if needed, control your inputs sizes using CSS with media queries or some other approach based on screen size/keyboard events.

Regards,
Tsvetina
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
Google Android
Asked by
Kjell
Top achievements
Rank 1
Answers by
Kjell
Top achievements
Rank 1
Pratik
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or