Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

onCreate, onCreateOptionsMenu, onResume, what is the order of execution?

I'm sorry if this question was asked before... Well anyway as what the title asked, when does onCreateOptionsMenu executed? before or after onResume?

In my app, when the activity first run/opened the order will be onCreate --> onResume --> onCreateOptionsMenu

But if I change the orientation of the device, it'll automatically called onDestroy and thus the activity will be re-created, in this case the order will be onCreate --> onCreateOptionsMenu --> onResume

I'm so confused now... anybody can give an explanation on this?

like image 678
CodingBird Avatar asked Sep 23 '13 09:09

CodingBird


1 Answers

You can read about onCreateOptionsMenu this :

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

like image 125
Peregreen Avatar answered Oct 23 '22 14:10

Peregreen