Skip to content

Clarification: onCreateOptionMenu() called ones but onPrepareOptionMenu() every time #33

@johnnyfivedev

Description

@johnnyfivedev

Fact:
onCreateOptionMenu() called ones but onPrepareOptionMenu() every time.

Proof:
onCreateOptionMenu() is only called once, the first time the options menu is displayed. To update the menu every time it is displayed, see onPrepareOptionsMenu(Menu).

onPrepareOptionMenu() Prepare the Screen's standard options menu to be displayed. This is called right before the menu is shown, every time it is shown

Problem:
Block diagram shows that every time onResume() called both onCreateOptionMenu() and onPrepareOptionMenu() are called. Which is not true.

Solutions:
"Called once, the first time the options menu is displayed or if menu invalidated" comment need to be added there or condition (diamond-like) block with text "first menu display or invalidated" and "yes" and "no" branches

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions