Fragment's onOptionsItemSelected doesn't get called

If your Activity's onOptionsItemSelected method returs true, the call is consumed in activity and Fragment's onOptionsItemSelected is not called. So, return false in your Activity onOptionsItemSelected method or parent class implementation via super.onOptionsItemSelected call (default implementation returns false).

According Activity class javadoc, method Activity.onOptionsItemSelected should:

Return false to allow normal menu processing to proceed, true to consume it here


You are not chaining to the superclass in the activity methods. Please have onCreateOptionsMenu() return super.onCreateOptionsMenu(menu), and have onOptionsItemSelected() return super.onOptionsItemSelected(item) (except for the item that you are handling, which should return true to indicate that you have handled the event).


In my case I did not add any menu items (i.e. I did not call onCreateOptionsMenu in either the activity or the fragment). However, I needed to use the action bar home (up) button in the fragment. For this I had to make sure that setHasOptionsMenu(true) was called in the fragment's onCreateView() method before this could work. Then I didn't need an onOptionsItemSelected override in my activity.