Android virtual keyboard up and down key press and bounce response events

Source: Internet
Author: User

  //Press the button to trigger the event     Public BooleanOnKeyDown (intKeyCode, KeyEvent event) {         Switch(keycode) { CaseKeyEvent.KEYCODE_DPAD_CENTER:display ("Middle key is pressed");  Break;  CaseKeyEvent.KEYCODE_DPAD_DOWN:display ("The next key is pressed");  Break;  CaseKeyEvent.KEYCODE_DPAD_LEFT:display ("Left button is pressed");  Break;  CaseKeyEvent.KEYCODE_DPAD_RIGHT:display ("Right button is pressed");  Break;  CaseKeyEvent.KEYCODE_DPAD_UP:display ("The upper key is pressed");  Break; }         return Super. OnKeyDown (KeyCode, event); }       //When the key bounces, the event that is triggered     Public BooleanOnKeyUp (intKeyCode, KeyEvent event) {         Switch(keycode) { CaseKeyEvent.KEYCODE_DPAD_CENTER:display ("Middle button is bouncing");  Break;  CaseKeyEvent.KEYCODE_DPAD_DOWN:display ("Next key is bouncing");  Break;  CaseKeyEvent.KEYCODE_DPAD_LEFT:display ("Left button is bouncing");  Break;  CaseKeyEvent.KEYCODE_DPAD_RIGHT:display ("Right button is bouncing");  Break;  CaseKeyEvent.KEYCODE_DPAD_UP:display ("Up key is bouncing");  Break; }         return Super. OnKeyUp (KeyCode, event); }  

Press the button to trigger the event
public boolean onKeyDown (int keycode, keyevent event) {
Switch (keycode) {
Case Keyevent.keycode_dpad_center:
Display ("Middle key is pressed");
Break
Case Keyevent.keycode_dpad_down:
Display ("Down key is pressed");
Break
Case Keyevent.keycode_dpad_left:
Display ("Left button pressed");
Break
Case Keyevent.keycode_dpad_right:
Display ("Right button is pressed");
Break
Case KEYEVENT.KEYCODE_DPAD_UP:
Display ("Upper key is pressed");
Break
}
Return Super.onkeydown (KeyCode, event);
}


When the key bounces, the event that is triggered
public boolean onKeyUp (int keycode, keyevent event) {
Switch (keycode) {
Case Keyevent.keycode_dpad_center:
Display ("Middle key is bouncing");
Break
Case Keyevent.keycode_dpad_down:
Display ("Next key is bounced");
Break
Case Keyevent.keycode_dpad_left:
Display ("Left button is bounced");
Break
Case Keyevent.keycode_dpad_right:
Display ("Right button is bouncing");
Break
Case KEYEVENT.KEYCODE_DPAD_UP:
Display ("Up key is bounced");
Break
}
Return Super.onkeyup (KeyCode, event);
}

Android virtual keyboard up and down key press and bounce response 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.