As we all know, it is important to maintain things like state & appearance while using an app. We also know that some of the most common scenarios in which this must be handled are rotation & lifecycle stages like sleep, closing the app, backgrounding, etc. I have looked at the following pages for help on these:
https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/handling-rotation
https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/activity-lifecycle/
From what I can tell, most of the code involved in making sure the app maintains a consistent appearance should go in OnCreate or OnResume. However, I am having trouble determining what code should go in which one. The diagram on the Activity Lifecycle page does not include what scenarios trigger each event, and whether the event is called always or only sometimes. I basically need a list of which events are raised (and whether they are raised always or only sometimes) for each of the following situations (maybe I forgot to list some here, but these are the ones I am most concerned about):
Opening the app (I know that this triggers OnCreate & OnResume)
Rotating an Activity
Navigating to a new Activity in the same app
Navigating to an Activity in the same that was navigated away from
Returning to the app after being backgrounded or going to sleep
I think most of the involved code would be the same for OnCreate & OnResume, but I am not sure how to avoid having it executed multiple times. Are there any good tutorials or diagrams that include both the scenarios & methods/events, as well as which methods/events are always triggered vs which ones are only sometimes? Thanks.