JakeWharton/ActionBarSherlock — Issue #272: FragmentActivity - options menu not respecting Fragment lifecycle
Author: jgilfelt
Created: 2012-02-15 13:46:59+00:00
State: open

When using the support lib plugin FragmentActivity with a Fragment based ViewPager, I get weird behavior when the fragments provide their options menu to the hosting Activity's action bar:

* The initial menu actions for the 1st fragment loaded into the ViewPager work fine.
* As soon as a 2nd fragment is paged into the UI, the menu actions become unresponsive.
* As soon as a 3rd fragment is paged into the UI, the actions that I tried to press for fragment #2 will fire, and so on.
* Orientation change yields similar results to fragment paging.
* There is a subtle visible artifact when a 2nd fragment is loaded, as if the new action items are being drawn over previous ones.

I am using a standard FragmentPagerAdapter pattern in my code. I have created a simple example project demonstrating this issue from the Google SupportDemos sample. It works flawlessly on my Galaxy Nexus with the native action bar, on anything else I get have the issues described above. I am using the ABS 4 RC1 library & support lib.

http://dl.dropbox.com/u/3982805/SherlockFragmentActivityMenuDemo.zip