Probem binding keyup events

Showing 1-4 of 4 messages
Probem binding keyup events B@ron 8/22/12 5:55 AM
Dears,

On Android, binding keyup could not succeed in several cases.
In my application (phonegap, jquery, jquery mobile) i am using a jquery mobile search field.
When the user encode string (detected listening event keyup) and after 3 seconds a JavaScript function is executed.
It works in chrome but not on Android 4.0.4 (Phonegap cordova 2.0.0) due to the following java code

@Override
    public boolean onKeyUp(int keyCode, KeyEvent event)
    {

        LOG.d(TAG, "KeyUp has been triggered on the view"+keyCode);

        // If back key
        if (keyCode == KeyEvent.KEYCODE_BACK) {
                this.loadUrl("javascript:cordova.fireDocumentEvent('backbutton');");
                return true;
        }
        // Legacy
        else if (keyCode == KeyEvent.KEYCODE_MENU) {
            this.loadUrl("javascript:cordova.fireDocumentEvent('menubutton');");
            return true;
        }
        // If search key
        else if (keyCode == KeyEvent.KEYCODE_SEARCH) {
            this.loadUrl("javascript:cordova.fireDocumentEvent('searchbutton');");
            return true;
        }
        return false;
    }

It works when using keydown as it returns true at the end and my own process is not interrupted by the return false.

@Override
    public boolean onKeyDown(int keyCode, KeyEvent event)
    {
    	LOG.d(TAG, "KeyDown has been triggered on the view"+keyCode);
    		//If volumedown key
            if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
                    // only override default behaviour is event bound
                    LOG.d(TAG, "Down Key Hit");
                    this.loadUrl("javascript:cordova.fireDocumentEvent('volumedownbutton');");
                    return true;
            }
            // If volumeup key
            else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
                    LOG.d(TAG, "Up Key Hit");
                    this.loadUrl("javascript:cordova.fireDocumentEvent('volumeupbutton');");
                    return true;
            }
            else
            {
                //return super.onKeyDown(keyCode, event);
            }
        //return super.onKeyDown(keyCode, event);
        return true;
    }
    
Can you please correct the code or take any action regarding this problem?
++
Thibaut de Sany.
Re: [PhoneGap] Probem binding keyup events Simon 8/23/12 7:41 AM
I believe this is already fixed. What version of PhoneGap are you using?

Simon Mac Donald
http://hi.im/simonmacdonald
> --
> -- You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com
>
> To compile in the cloud, check out build.phonegap.com
>
>
Re: Probem binding keyup events Milky Boy 9/6/12 8:30 AM
Dear,

I am facing the same problem. keyup does not respond ! I am using cordova 2.0.0. Aka latest stable.
Is this fixed in the 2.0.1 rc or something?

Thanks !
Miloud
Re: Probem binding keyup events Alejandro Sack 7/5/13 3:17 AM
With version 2.3.0 works fine!