public class Engineerjspactivity extends Activity {private static String Tag = "engineerjspactivity"; @Overrideprotecte d void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); LOG.D (Tag, "onCreate ()"); Setcontentview (R.layout.activity_main);} @Overrideprotected void OnStart () {Super.onstart (); LOG.D (Tag, "OnStart ()");} @Override protected void Onresume () {super.onresume (); LOG.D (Tag, "Onresume ()"); } @Override protected void Onsaveinstancestate (Bundle outstate) {super.onsaveinstancestate (outstate); LOG.D (Tag, "onsaveinstancestate ()"); } @Override protected void OnPause () {super.onpause (); LOG.D (Tag, "OnPause ()"); } @Override protected void OnStop () {super.onstop (); LOG.D (Tag, "onStop ()"); } @Override protected void onrestoreinstancestate (Bundle savedinstancestate) {super.onrestoreinstancestate (sav Edinstancestate); LOG.D (Tag, "onrestoreinstancestate ()"); } @Override protected VOID OnDestroy () {Super.ondestroy (); LOG.D (Tag, "OnDestroy ()"); }}② performs activity (which normally starts the activity without switching the screen) and obtains the following results, for example:
③ the activity life cycle when switching Cheng:
④ change back to the activity lifecycle of the vertical screen:
⑤ Add android:configchanges= "Orientation" property to the manifest file. Start the activity again, without switching the screen (normal boot) life cycle:
⑥ plus android:configchanges= "orientation" property. Switch to a horizontal screen, the activity life cycle:
⑦ plus android:configchanges= "orientation" property. To change back to the vertical screen, the activity life cycle:
⑧ plus android:configchanges= "orientation" Keyboardhidden "property. Normal start activity life cycle (not cut screen):
⑨ plus android:configchanges= "orientation" Keyboardhidden "property. Normal start activity life cycle (cut into horizontal screen):
⑩ plus android:configchanges= "orientation" Keyboardhidden "property. Normal start activity life cycle (back to vertical screen):
The life cycle after the home key is executed:
Android Interview Screen Toggle activity lifecycle