0

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?

ugur
  • 3,604
  • 3
  • 26
  • 57
Lucas N
  • 69
  • 9
  • I am not sure but try experimenting `setOnPageChangeListener` it is the callback for tab switching. – Enzokie Aug 14 '16 at 01:03
  • Possible duplicate of [Show menu items depending ViewPager Android](http://stackoverflow.com/questions/28342181/show-menu-items-depending-viewpager-android) – ugur Aug 14 '16 at 01:03

0 Answers0