Atitit.android JS keyboard keys detect back key home and menu key events

Source: Internet
Author: User

atitit.android JS keyboard key detection Back key Home key and Menu key event

1.OnKeyDown

@Override

  Public Boolean OnKeyDown(int KeyCode, KeyEvent Event) {

  if (KeyCode == KeyEvent.Keycode_menu) { 

//Do the things you want to do here

//Super.openoptionsmenu (); Call this, you can pop up the menu

WebView . Loadurl ("Javascript:keycode_menu_handle ()") ;   

    }    

return true; ///Finally, be sure to return true after finishing, or return True after the popup menu, other keys return super, let other keys default

 }

function Keycode_menu_handle ()

{

Alert ("---menu handle start");

}

Author :: ★ (Attilax) >>>    nickname : old-Wow paw   (   full name:: ATTILAX AKBAR AL RAPANUI&NBSP, Attilax &NBSP, " "  Al   Rapa Nui &NBSP,   Kanji name: Ayron, Email:[email protected]

reprint Please indicate source: http://www.cnblogs.com/attilax/

2.Other keycode Check

Document.onkeydown=function (event) {

var e = Event | | window.event | | Arguments.callee.caller.arguments[0];

Alert ("KeyCode:" +e.keycode);

};

2.1.1.android handling Span style= "font-family:arial;" >back key home Keys and key event ( ext. )-Wainiwann- Blog Park

Year 5 month - Androidhandling the back keyHomeKeys andMenukey Event ( go ) @Override public boolean onKeyDown (int keycode, keyevent event) {if (keycode = = KeyEvent . Keycode_bac.

Atitit.android JS keyboard keys detect back key home and menu key events

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.