What is the difference between onCreateOptionsMenu(Menu menu) and onPrepareOptionsMenu(Menu menu)?

前端 未结 1 402
失恋的感觉
失恋的感觉 2021-02-01 00:58

Explain difference between onCreateOptionsMenu(Menu menu) and onPrepareOptionsMenu(Menu menu).

相关标签:
1条回答
  • 2021-02-01 01:33

    onCreateOptionsMenu() is called once.
    onPrepareOptionsMenu() is called every time the menu opens.


    From the onCreateOptionsMenu() documentation:

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

    0 讨论(0)
提交回复
热议问题