Issue
I have some code in the onCreate method an Activity and noticed that it is being called three times. Is it normal behaviour? Thanks.
Solution
You might want to read through the documentation on the href="https://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle" rel="nofollow noreferrer">Activity lifecycle.
OnCreate will only be called one time for each lifetime of the Activity. However, there are a number of situations that can cause your activity to be killed and brought back to life. Thus, onCreate will be called again.
To support this properly, you can save state information in onSaveInstanceState and restore it fron the state bundle you get in on create.
Answered By - Cheryl Simon
Answer Checked By - Pedro (JavaFixing Volunteer)