Process for handling the onkeydown, onkeyup, and onkeymultiple events of listview in Android

Source: Internet
Author: User

 

 

There are three onkey events in the listview source code of Android: onkeydown, onkeyup, and onkeymultiple, all of which are processed by the commonkey method.

In the commonkey method, only local processing is overwritten for action_down, that is, only onkeydown is processed. The other two are processed by submitting them to the onkey method of the parent class.

 

For listview, the onkey event call path is divided by the key type as follows:

Action_down:

Keycode_dpad_center, keycode_enter, keycode_space:

Onkeydown (listview. Java)-> commonkey (listview. Java)

Keycode_dpad_up, keycode_dpad_down, keycode_dpad_left, and keycode_dpad_right:

Onkeydown (listview. Java)-> commonkey (listview. Java)

Keycode_back:

Onkeydown (listview. java)-> commonkey (listview. java)-> sendtotextfilter (abslistview. java)-> determines whether to call onkeydown (view. java) [Note: onkeydown (view. java) does not process the keycode_back code. Therefore, false is returned]

Action_up:

Keycode_dpad_center, keycode_enter, keycode_space:

Onkeyup (listview. java)-> commonkey (listview. java)-> sendtotextfilter (abslistview. java) [Note: simply return false]-> onkeyup (abslistview. java)-> onkeyup (view. java)

Keycode_dpad_up, keycode_dpad_down, keycode_dpad_left, and keycode_dpad_right:

Onkeyup (listview. java)-> commonkey (listview. java)-> sendtotextfilter (abslistview. java) [Note: simply return false]-> onkeyup (abslistview. java)-> onkeyup (view. java) [Note: onkeyup (abslistview. java) and onkeyup (view. java) does not process code for keycode_dpad_up, keycode_dpad_down, keycode_dpad_left, and keycode_dpad_right. Therefore, false is returned]

Keycode_back:

Onkeyup (listview. java)-> commonkey (listview. java)-> sendtotextfilter (abslistview. java)-> determines whether to call onkeyup (view. java) [Note: onkeyup (view. java) does not process the keycode_back code. Therefore, false is returned]

Action_multiple:

Action_multiple refers to multiple consecutive recurring events, which can be divided into multiple above action_down and action_up.

Related Article

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.