Android Interview Screen Toggle activity lifecycle

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.