It's been a long time of Android development, but it's been ambiguous on some basic things ... Like this onpause and OnStop. If you jump from one interface to another, which is called?
After my experiment. It's clear. OnPause is an active state that becomes inactive. OnStop () is turned invisible. Then jumping from one page to another is called onpause,onstop. Look at the program:
Package Com.example.fuhe;import Android.os.bundle;import Android.app.activity;import android.content.intent;import Android.util.log;import Android.view.menu;import Android.view.view;public class Mainactivity extends Activity {@ overrideprotected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview ( R.layout.activity_main);} public void Click (View view) {Intent Intent = new Intent (); Intent.setclass (this, ss.class); startactivity (Intent);} @Overridepublic boolean Oncreateoptionsmenu (Menu menu) {//Inflate the menu; This adds items to the action bar if it is PR Esent.getmenuinflater (). Inflate (R.menu.main, menu); return true;} @Overrideprotected void Onrestart () {Super.onrestart (); LOG.E ("Mainactivity", "Onrestart");} @Overrideprotected void Onresume () {super.onresume (); LOG.E ("Mainactivity", "Onresume");} @Overrideprotected void OnPause () {super.onpause (); LOG.E ("Mainactivity", "OnPause");} @Overrideprotected void OnStop () {super.onstop (); LOG.E ("Mainactivity", "OnSTop ");}}
Package Com.example.fuhe;import Android.app.activity;import Android.os.bundle;import Android.view.view;public class SS extends activity{@Overrideprotected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (R.LAYOUT.SS);} public void Click (View view) {Finish ();}}
Logcat: Jumps from the first page to the second page, then returns the case