For Android versions later than 2.1, is onCreate() called upon rotation? I put a log print in onCreate(), but it does not print for 2.3.3 and 4.0.3.
Here’s the code:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Runtime runtime = Runtime.getRuntime();
long free = runtime.freeMemory();
long total = runtime.totalMemory();
long occupied = total - free;
Log.i("MEM", "heap: " + occupied);
}
On 2.1, the log message prints multiple times due to orientation; on 2.3.3, it only prints once.
Yes, it is always called (with the exception being as noted above by K_Anas). It goes through the whole process. See this link, especially the configuration changes section.
And a graphic of the lifecycle.