Tag:android interview
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 ()"); }}② running activity (normally starting activity without switching the screen), the following results are obtained:
③ the activity life cycle when switching Cheng:
④ change back to the activity lifecycle of the vertical screen:
⑤ adds the android:configchanges= "orientation" property to the manifest file, restarting the activity without the life cycle of the screen (normal boot):
⑥ plus android:configchanges= "orientation" attribute, switch to horizontal screen, activity life cycle:
⑦ plus android:configchanges= "orientation" attribute, change back to vertical screen, activity life cycle:
⑧ plus android:configchanges= "orientation" Keyboardhidden "property to start the activity life cycle normally (without cutting the screen):
⑨ plus android:configchanges= "orientation" Keyboardhidden "property, normally starts the activity's life cycle (cut into the horizontal screen):
⑩ plus android:configchanges= "orientation" Keyboardhidden "property to start the activity life cycle normally (back to the vertical screen):
The life cycle after the home key is executed:
Android Interview Screen Toggle activity lifecycle