Skip to content Skip to sidebar Skip to footer

Phonegap + Android 4.4: How To Detect When The Softkeyboard Hides?

I tried to add a event listener to detect when the softkeyboard hides, but it doesn't work! I tried this code: document.addEventListener('deviceready', function() {

Solution 1:

Try this::

    var lastFocused;

    $(document).on("focusout","input[type='date'],input[type='time'],input[type='week'],input[type='text'],textarea,select",function(){
        lastFocused = undefined;
        // console.log("yes me call focusout");
    });

    $(document).on("focus","input[type='date'],input[type='time'],input[type='week'],input[type='text'],textarea,select",function(){

        if(utils.isUndefined(lastFocused) == false && lastFocused.is($(this)) == false){
            lastFocused.blur();
            ///////////////////////////////////////////////////////////////////////////////
            // console.log("Here you can get your keyboard is hide");
        }

        lastFocused = $(this);
        // console.log("yes me call focus");

    });

Solution 2:

I found the solution to my problem. The problem was that the 'hidekeyboard' event was never triggered by Phonegap due to the fact that the webview had errors and was static (it never resizes when the softkeyboard was triggered). As the webview never resizes, the event never is triggered.

We can find the triggering of the event in the class LinearLayoutSoftKeyboardDetect.

Thanks to all!

Post a Comment for "Phonegap + Android 4.4: How To Detect When The Softkeyboard Hides?"