Intent refers to the transformation of the two UI main interface, which requires learning the life cycle of an activity to understand the intent
The default in the UI interface shows the run as running state, while the OnPause method in the background
Main:
OnCreate ()-OnStart ()-Onresume ()-->onpause ()-->onstop ()-->ondestroy ()
Sub-line:
OnCreate ()-OnStart ()-Onresume ()-->onpause ()-->onstop ()-->onrestart ()-->onstart () Onresume ()-->onpause ()-->onstop ()-->ondestroy ()
Now let's take a look at the activity's declaration cycle.
By default creating an Android project will default to you to create a OnCreate method
Let's write it down separately.
protected void OnCreate (Bundle savedinstancestate); protected void OnStart (); protected void Onrestart (); protected void Onresume (); protected void OnPause (); protected void OnStop (); protected void OnDestroy ();
Use an example to see its life cycle.
Package Com.example.activity;import Android.os.bundle;import Android.app.activity;import android.view.Menu;public Class Mainactivity extends Activity {@Override protected void onCreate (Bundle savedinstancestate) {Super.on Create (savedinstancestate); Setcontentview (R.layout.activity_main); System.out.println ("onCreate-----Activity Establishment-----"); } @Overrideprotected void Onresume () {//TODO auto-generated method Stubsuper.onresume (); System.out.println ("onresume-----activity shows to the main UI-----");} @Overrideprotected void OnDestroy () {//TODO auto-generated method Stubsuper.ondestroy (); System.out.println ("OnDestroy-----activity destroyed, can no longer restart-----");} @Overrideprotected void OnPause () {//TODO auto-generated method Stubsuper.onpause (); System.out.println ("onPause-----activity suspended exiting to bottom-----");} @Overrideprotected void Onrestart () {//TODO auto-generated method Stubsuper.onrestart (); System.out.println ("onrestart-----activity into the restart queue----");} @Overrideprotected void OnStart () {//TODO AuTo-generated method Stubsuper.onstart (); System.out.println ("onStart-----Activity Restarts-----");} @Overrideprotected void OnStop () {//TODO auto-generated method Stubsuper.onstop (); System.out.println ("onStop-----Activity Stop-----");} }When you start a project
Press the main Menu key on the simulator
Click on the installed program to re-return the program
Press the exit key to exit the program
In fact, the UI display of different activity is a stack process that displays the activity at the top of the stack.
Next Forecast: Intent intent
Learn the life cycle of android<activity from scratch. 39 .>