سؤال

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