My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 39721: 4.2 Fragments: onResume() called before onCreateOptionsMenu()
46 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----


Sign in to add a comment
 
Reported by yanche...@gmail.com, Nov 15, 2012
On API <= 16 Fragment's onCreateOptionsMenu() is always called before onResume() which makes sense. On 4.2 the order has changed, which doesn't.
Nov 27, 2012
#1 daniele.athome@gmail.com
Agree. I had to modify my application to make it work because it depended on that call order.
Feb 15, 2013
#2 dan...@parkinginmotion.com
It looks like this behavior was never guaranteed. It probably should have been, which would be a lot more convenient. However, ensuring that onResume() doesn't depend on onCreateOptionsMenu() will always be correct :/
Apr 7, 2013
#3 kaiyang...@gmail.com
What if activity sequence also changed in future version, causing tremendous crashes in app for people who upgraded their rom.
Google shouldn't do this without proper documentation.
Jun 26, 2013
#4 thomas.bruyelle@gmail.com
Its an issue for me, I want to update an item in my action bar, so I need to grab it from the Menu (in onCreateOptionsMenu()) and then update it in onResume(). With this new call order, I can't...
Dec 18, 2013
#5 david.mi...@gmail.com
Sorry for coming late to this - and sorry if this is not the correct place to ask questions - but this does cause me some trouble at the moment...
Is there some other life cycle method that's guaranteed to be called after onCreateOptionsMenu?

Dec 18, 2013
#6 arusahni
I believe you can call onPrepareOptionsMenu. The downside is that it gets called every time the options menu is displayed.
Apr 1, 2014
#7 newman...@gmail.com
This seems crazy to me as well.  I need to get a handle on one of the action bar buttons such that I can enable/disable it on events.  However I run into the problem where my onResume sets up listeners (as it should), but callbacks get invoked before my options menu is set up.  So now I have to register listeners in my onPrepareOptionsMenu which seems bad.  IMHO onCreate should not finish until the menu is created or at the very least onResume should not be called until the menu is available.
Sign in to add a comment

Powered by Google Project Hosting