@Override
public void onCreateOptionsMenu(Menu menu,MenuInflater inflater){
Log.d(\"Does\", \"get called\");
inflater.inflate(R.menu.menuItem
You need to do two things. Step 1: In Fragment OnCreateView add setHasOptionsMenu(true);
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
setHasOptionsMenu(true);
return inflater.inflate(R.layout.fragment_user_settings, container, false);
}
Step 2: you need to add getActivity().invalidateOptionsMenu(); in your fragment in OnViewCreated. Or in mainActivity when you change the Fragment.