I am using a ViewPager
along with a FragmentPagerAdapter
to swipe through tabs and I want each fragment to display a different Options Menu.
I have the code in the onPrepareOptionsMenu()
method for each fragment but this method never seems to be called by the ViewPager
when swiping through the fragments so the options menu in the action bar never changes.
Where do I call the invalidateOptionsMenu()
method in order to make it so each fragment has its own unique Options Menu in the Action Bar?