Now the phone by default, you can switch between the screen, but the life cycle of the screen switching is how, today to explain, in case you develop the app screen when the game over
1. Load an activity's print log without making any configuration:
Print log for direction when switching screen:
PS: I don't see anything here. Horizontal screen Switch vertical screen when performing two times OnCreate, personally feel wrong
2. When the android:configchanges= "Keyboardhidden|orientation|screensize" is configured, the restart activity does not occur when the screen switches
3. When configuring Android:configchanges= "Keyboardhidden|orientation", the
(1) android:targetsdkversion>12, the screen switch or restart activity will occur.
(2) android:targetsdkversion<=12 , when the screen is switched, the activity is not restarted and only calls Onconfigurationchanged
4. When configuring android:configchanges= "orientation", restart the activity when the screen switches
Summarize:
1. When the android:configchanges= "orientation" is not configured and configured, the activity needs to be restarted when the screen switches
2. When configuring Android:configchanges= "Keyboardhidden|orientation|screensize", when the screen switches, do not restart activity, execute onconfigurationchanged
3. Configure android:configchanges= "Keyboardhidden|orientation"
(1) android:targetsdkversion>12, the screen switch or restart activity will occur.
(2) android:targetsdkversion<=12 , when the screen is switched, the activity is not restarted and only calls Onconfigurationchanged
Life cycle of Android screen switching