Yes, this method is slightly different for the snippet:
void onCreateOptionsMenu(Menu menu, MenuInflater inflater)
and activity:
boolean onCreateOptionsMenu(Menu menu)
The logic is quite simple: if you have the same action panel (as many actions) for all fragments, it is better to define it in action. If the Action Bar layout depends on the fragment, it is better to define it there.
nikis source
share