At first, it might look that onCreate() is very straightforward--it gets called only once when an Activity gets created. However, the tricky bit is that an Activity can get destroyed and created not just when it is actually started (with startActivity()).
An Activity will also be destroyed and created in the following cases:
- A device is rotated so that the orientation changes from landscape to portrait or vice versa
- A system language changes
- On Android 7.0, in multiple Activity or Application configurations, an Activity's space is resized
- Hardware keyboard is popped out
In all of these cases, the currently running Activity will be destroyed and created with a new configuration as a completely new instance ...