Android Interview Screen Toggle activity lifecycle

Source: Internet
Author: User

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

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.