The life cycle of the experimental activity
Packagecom.example.chenshuai.test;Importandroid.app.Activity;ImportAndroid.os.Bundle;ImportAndroid.util.Log;/*** Created by Chenshuai on 2016/3/16.*/ Public classAxtivity2extendsActivity {//callback Method@Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); Setcontentview (r.layout.layoutactivity); /*System.out.println ("This is the first activity I run"); Output log log.e ("Test", "Log output Information"),//eror Red LOG.W ("test", "Log output Information"),//warning Blue log.d ("test", "Log Input"); Information "); LOG.I ("Test", "Log output Information"); LOG.V ("Test", "Log output Information");*/LOG.E ("TAG", "create" ); } @Overrideprotected voidOnStart () {Super. OnStart (); LOG.E ("TAG", "Start"); } @Overrideprotected voidOnresume () {Super. Onresume (); LOG.E ("TAG", "Display"); } @Overrideprotected voidOnDestroy () {Super. OnDestroy (); LOG.E ("TAG", "destroy"); } @Overrideprotected voidOnPause () {Super. OnPause (); LOG.E ("TAG", "Pause" ); } @Overrideprotected voidOnStop () {Super. OnStop (); LOG.E ("TAG", "Stop"); } @Overrideprotected voidOnrestart () {Super. Onrestart (); LOG.E ("TAG", "reboot"); }}
When you start an activity
When you click the Home button
Just paused, stopped, not destroyed.
and return
is to restart
When you click the Back button (exit)
Final Destruction
Re-open
will be created again
The life cycle of android--activity and intent and activity