onCreateOptionsMenu is called before onResume
gregd opened this issue · comments
When device is rotated, onCreateOptionsMenu and onPrepareOptionsMenu methods are called before onResume.
What device/OS/version are you using?
Last year I was testing my app on Samsung P5100, Android 4.1. That strange sequence of events occurred on that device.
Today I have a new Samsung SM-T815, Android 5.0.2. I also use support libs in my app. And surprisingly the events sequence is correct now.
I guess that the problem I faced was caused by a bug in Android 4.1. Unfortunately, I have no P5100 device to repeat the test. So probably my issue should be closed.
I'd the same issue with Nexus Emulator API 25.
If anyone is searching here for a workaround to this issue, just call invalidateOptionsMenu() on your onResume method.