Why onCreate is called on Activity when rotating android tablet?

android, android-activity

Solution

It is not just onCreate(). When the screen is rotated, the activity is paused, stopped, and restarted. See this question for more info: Activity lifecycle - onCreate called on every re-orientation

If the question is "Why does this happen?" the answer has to do with functionality inside of Android's activities and windows. More specifically, android currently does not have a way to move, resize, and relayout each and every view when the orientation is changed. To make handling this scenario possible, the simpler implementation of just tearing down the activity and bringing it back up in a different orientation was implemented.

Problem

onCreate method is called every time on Activity whenever screen is rotated. Is it just onCreate being called again or whole activity is re-created?

Original source

Related problems