Skip to content

Instantly share code, notes, and snippets.

View j-garin's full-sized avatar

Yevhen Harastovych j-garin

View GitHub Profile
@j-garin
j-garin / AndroidBug-OptionItems-Fragments-29472-workaround.md
Created March 14, 2018 11:01 — forked from danielesegato/AndroidBug-OptionItems-Fragments-29472-workaround.md
Android Option Menu + Fragments Workaround with ViewPager / ActionBar / Drawer, Menu Items not displaying

This gist is a workaround to this bug:

https://code.google.com/p/android/issues/detail?id=29472

No changes are needed to your current code but changing the extended fragment/activity class.

All you have to do is put this two classes in your code and make your activity extend MenuManagerActivity and your fragment MenuDelegatorFragment. If you are using Nested fragment you must make sure that all fragments containing nested Fragments with options menu also extend MenuDelegatorFragment (both if the parent fragment need an option menu both if it doesn't need it).