質問

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?

役に立ちましたか?

解決

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top