If my program is
public class mainActivity extends Activity
{
public void OnCreat () {
super.onCreate (savedInstanceState);
setContentView (R.layout.main);
}
}
which did not perform OnStart () and OnResume (), how the simulator will enforce it ?
When executed Onstart () and Onresume it?
Online ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
------ Solution ------------------------------------ --------
normal startup procedure : onCreate () -> onStart () -> onResume ();
normal exit : onPause () -> onStop () -> onDestory ()
an Activity starts another Activity: onPause () -> onStop (), and then return : onRestart () -> onStart () -> onResume ()
program by back exit : onPause () -> onStop () -> onDestory (), then enter : onCreate () -> onStart () -> onResume ();
press home to exit the program : onPause () -> onStop (), then enter : onRestart () -> onStart () -> onResume ();
------ Solution ------------------------------------ --------
will be executed after the onCreate onStart, and the screen has been displayed, but can not interact ; then perform onResume, then you can interact with the user .
add Log to see it, could not perform onStart, onResume your view on the show .
------ Solution ---------------------------------------- ----
nor deep understanding of life cycle
------ Solution -------------------------- ------------------
your Activity inheritance Activity, if you do not replicate the method , it will call the parent class method
----- - Solution --------------------------------------------
< br /> execution is the parent class onStart and onResume
------ eference --------------------------- ------------
Onstart what I'm asking is , when executed ( ) and Onresume (). . . . . .
I did not write the program code Onstart () and Onresume (). . . . . . . . . .
perform the entire procedure from the beginning mainActivity right ?
following execution onCreat (), then the program will perform over ah ?
not running start, resume, pause, stop, destroy ah ?
------ eference --------------------------------------- < br>
a subclass inherits a parent class , as my Activity inherit Activity. So, if there is no replication subclass superclass method , then the sub-class will automatically call the parent class's way?
If not, you have the wrong reply logical problems .
------ eference --------------------------------------- < br>
phrase code execution is onStart and onResume parent class ?
------ eference --------------------------------------- < br>
phrase code execution is onStart and onResume parent class ?
Yes onStart and onResume execution is the parent class .
------ eference ------------------------ ---------------
subclass does not override , the direct parent Activity call this method the
------ eference --- ------------------------------------
this is an object-oriented polymorphism .
------ eference ---------------------------------------
understand , and now know
没有评论:
发表评论