52

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

naXa
  • 26,677
  • 15
  • 154
  • 213
Jumpo
  • 591
  • 2
  • 5
  • 7

1 Answers1

95

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).

Sam
  • 84,460
  • 18
  • 172
  • 171