Which life-cycle method will execute when I reopen the app ?
onStart
executes when we view the app, onStop
executes when we minimize it, Will the onStart
method executes again if maximize it?
How about checking it yourself. This can be a good exercise as well. Override all these methods and put individual logs in each of them so you can identify for eg
@Override
protected void onResume() {
super.onResume();
Log.e("Activity TAG","On Resume");
}
Check the logcat output and verify this for yourself. Hope it helps.
Since @Mohit Patel mentioned in his comment and posted a photo about it, combined with the @Karan Mer answer, your answer is: Yes, the onStart method executes again if maximize it.
You can prove it like this:
@Override
protected void onResume() {
super.onResume();
Log.e("Activity TAG","On Resume");
}
@Override
protected void onStart() {
super.onResume();
Log.e("Activity TAG","On start");
}
The lifecycle is the ABC of Android. You should be careful with it. This is the activity lifecycle:
https://developer.android.com/guide/components/images/activity_lifecycle.png
or if you are using fragments:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.