I have a fragment that is called before then activity's onCreateOptionsMenu(Menu menu)
method.
First is called fragment's onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
method.
When this method is finished is called the other one activity's method.
The problem is that i need to work inside onCreateView()
fragment method with the menu, so i'm finding a way to call first the menu activity's method.
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_media_annuale, container, false);
final StudentGrades activity = ((StudentGrades)getActivity());
//here the activity onCreateOptionsMenu(Menu menu)
//method have to be called
//here i begin to check something with the menu
//(for this reason i need that it's ready)
//
//...
//
return rootView;
}
i'm reading some solutions for example calling: activity.invalidateOptionsMenu();
method. But it doesnt work.