In fact, a good question, because it is not very obvious, even if you read about the life cycle of the Activity .
So, briefly: The first thing that happens is that an Activity object is created. At the same time, only its constructor works and nothing else:
Activity activity = new Activity();
But usually no one creates an object in this form. Instead, everything goes through the Intent :
Intent intent = new Intent(previousActivity, Activity.class); startActivity(intent);
If there is no previous Activity (in this case, previousActivity ), then the system simply starts the selected Activity.class, in fact, also via intent.
Only after startActivity(intent) onCreate(Bundle savedInstanceState) method onCreate(Bundle savedInstanceState) , i.e. in other words, it is this startActivity that startActivity launches it. In fact, the chain is slightly longer:
startActivity -> create () -> onCreate ()
In fact, the developer does not have access to the create () method, it can even be called differently, in any case, this method creates an Activity and starts the callback onCreate ;
Further, as soon as onCreate works, it starts the callback , which in turn launches the start () method, it launches the callback onStart , onStart in turn, launches the callback , which launches resume () and then the callback onResume .
As for onCreateOptionsMenu everything is not so obvious, since in different versions of Android the launch looked different. Intentionally omitting the old versions, you can say for sure that with Android 3.0+, according to the documentation, it starts at the start of the Activity, ie in the start () method in the order in which the app bar elements are displayed (usually the support bar is used as the app bar)