What is the call order of oncreateoptionsmenu() in the android activity lifecycle?

我怕爱的太早我们不能终老 提交于 2020-01-24 03:13:05

问题


Is onCreateOptionsMenu() of action bar called before or after the onStart() of activity?


回答1:


onStart() is called first. (I tried putting log messages in the methods).




回答2:


I found this order to be the correct one

onCreate() - onStart() - onResume()- onCreateOptionsMenu()




回答3:


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

This is written in the Android documentation.



来源:https://stackoverflow.com/questions/22340598/what-is-the-call-order-of-oncreateoptionsmenu-in-the-android-activity-lifecycl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!