I am looking through a tutorial and it showed this sample code for creating a menu:
public void onCreateOptionsMenu(Menu m) {
super.onCreateOptionsMenu(m);
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.time_list_menu, m);
}
I got an error, so I changed it to boolean, this is what it is now, and therefore I did it instead, and its working:
public boolean onCreateOptionsMenu(Menu m) {
super.onCreateOptionsMenu(m);
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.time_list_menu, m);
return true;
}
But I also have such things from another question here, when the stack overflows
Understanding why onCreateOptionsMenu doesn't display a menu
The Android document also has the following:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.game_menu, menu);
return true;
}
Where was the call for super and why is it not needed? What is the correct way to create a menu if I do it wrong?
While I am on this subject, Doc also shows @Override, but I don't have it, and its work. I'm just confused as to whether this is necessary if the methods are explicitly overridden. I appreciate the help. IF any clarification is needed, please let me know.