Pressed action item not dispatched until exiting Activity

Author: yukukuCreated Apr 18, 2012Updated Aug 28, 2014
LabelsBug ReportNeeds-More-Info

This worked in 4.0.0, but no longer work on 4.0.2. After trying each commit to find out where it fails, I found that it worked at 6337076 but failed to work at fca84af "Use the mule to determine proper fragment menu dispatch results."

I have an Activity (subclass of SherlockFragmentActivity) containing a fragment (subclass of SherlockFragment). The fragment calls setHasOptionsMenu(true) and inflates a menu item at onCreateOptionsMenu. Hence the (only) action item button is shown on the right corner of the action bar.

Somehow, when I click on the action item, the pressed state is not displayed. It is as though the action item button is not pressed at all. However, when I click on another button (not actionbar button) at the same activity that opens another activity, suddenly the onOptionsItemSelected of the fragment is called!

This happens in 2.3.7, tried in both Nexus One CM 9.2.0-RC1 and Intel x86 emulator. This works correctly in ICS (4.0.2).

Thanks for writing such a good library!

Source: JakeWharton/ActionBarSherlock