onoptionsitemselected, onmenuitemselected, oncontextitemselected differences in Android development

Source: Internet
Author: User

1. When I click on the menu item of the option menu (optionsmenu: Click menu popup), call the onmenuitemselected also call the onoptionsitemselected, so I wonder what they are different.                       Then look at the context menu (ContextMenu: pops up when the control is long pressed.               For example, when you press and hold Edittextview to pop up the input method to select a menu), when you click on the menu item in the context menu, the call to Onmenuitemselected also calls the oncontextitemselected, so the problem is clear.      In the Onmenuitemselected method of the parent activity, if the option menu goes onmenuitemselected, the context menu goes oncontextitemselected.                       2. Onprepareoptionsmenu: Call onoptionsmenuclosed before the Options menu is displayed: Called when the options menu is closed Oncontextmenuclosed: Called when the context menu is closed

onoptionsitemselected, onmenuitemselected, oncontextitemselected differences in Android development

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.