Old Version Summary:
1. Do not set the activity of the android:configchanges when the screen will recall the life cycle method, cut the horizontal screen call 1 times the vertical screen call 2 times
2. When setting the activity's Android:configchanges = "orientation", both the horizontal and vertical screens are called 1 life cycles
3. Set the activity's Android:configchanges = "orientation| Keyboardhidden "The time-cut screen does not invoke the life cycle method, only the Onconfigurationchanged method is called
Api13 above has changed (forwarded from: http://www.cnblogs.com/xiaoQLu/p/3324503.html)
If the activity is not recreated when you want to resolve the screen switching, you need to configure the android:configchanges= "Orientation|keyboardhidden" attribute in manifest, of course, in api>13, You need to add an additional parameter, that is screensize, do not add this, in the API 13 above the mobile phone will not be effective.
1) Different API re-creation activity life cycle also has a difference
A) 2.3 on:onsaveinstancestate->onpause->onstop->oncreate->onstart->onrestoreinstancestate-> Onresume
b) 4.0 on (3.2 I didn't test, only tested 4.0):onpause->onsaveinstancestate->onstop->oncreate->onstart-> Onrestoreinstancestate->onresume
2) do not re-create activity, only call onconfigurationchanged
Targetsdkversion will affect the life cycle, targetsdkversion in 12 and below, set the android:configchanges= "Orientation|keyboardhidden", The activity is not recreated on the machine, only the onconfigurationchanged is called, and if the targetsdkversion>12 is set, it only works on the sdkversion<=12 machine,> 12 of the machine activity will be re-created (need to add screensize to effect)
New Summary:
(1) Set android:configchanges= "orientation" and do not set this property, life cycle performance is to recreate activity
(2) Set android:configchanges= "Orientation|keyboardhidden", shown on 2.3 is not re-created activity,4.0 as follows
A) android:targetsdkversion<= "12", life cycle performance is not re-created activity
b) android:targetsdkversion> "12", expressed as re-creation of activity
(3) Set android:configchanges= "Orientation|keyboardhidden|screensize", on 2.3 and 4.0 are not re-created
The rest of the situation:
Current activity generates event popup toast and Alertdialog when the activity is alive
There's no change in cycle.
When the activity is running, press the home key (the same as being fully overwritten): Onsaveinstancestate--
OnPause--OnStop onrestart-->onstart--->onresume
Activity not being completely overwritten just loses focus: onPause--->onresume
Life cycle of Android switching screen