In an app activity, I have four different fragments. I have added menus to each fragment with
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {}
function. But when I swipe to next fragments, and come back to previous, the menu options of the next fragment, get added to the menu in the current visible fragment. Also added the first statement menu.clear()
in the onCreateOptionsMenu()
but no effect. Stuck at this issue.