当前位置:网站首页>Activity startup mode and life cycle measurement results
Activity startup mode and life cycle measurement results
2022-06-23 05:53:00 【Muzi 102】
I am often asked by the interviewer during the interview activity Life cycle problems , However, we usually only have a brief understanding of the common , While the interviewer is always asking about the life cycle of exotic situations , So I wrote a demo, Carefully check the real situation and the results ( The most embarrassing thing is that the interviewer said , Go back and try )

Activity Boot mode
standard: Create everything ( Default startup mode )
singleTop: Not on top target Activity,new One
singleTask: Not on top target Activity, remove target Above , Turn yourself into top.
singleInstance: Open up private task, Other completely independent of the program activity Of task.
standard Pattern
One 、 Under normal circumstances, start a activity, Its life cycle :(Activity_A Do a test )
1、 start-up ->back Key returns :
onCreat()->onStart()->onResume()->onPause()->onStop()->onDestroy()
2、 start-up ->home desktop -> And on again app( Without being killed ):
onCreat()->onStart()->onResume()->onPause()->onStop()->onRestart()->onStart()->onResume()
singleTop Pattern
One 、 Under normal circumstances, start a activity, Its life cycle :(Activity_B Do a test )
1、 start-up ->back Key returns : The result is the same as standard Pattern
2、 start-up ->home desktop -> And on again app( Without being killed ): The result is the same as standard Pattern
3、 Already on top , Start your situation again :
onCreat()->onStart()->onResume()->onPause()->onNewIntent()->onResume()->onPause()->onStop()->onDestroy()
4. There are already... In the stack , But not at the top :
singleTask Pattern
One 、 Under normal circumstances, start a activity, Its life cycle :(Activity_B Do a test )
1、 start-up ->back Key returns : The result is the same as standard Pattern
2、 start-up ->home desktop -> And on again app( Without being killed ): The result is the same as standard Pattern
3、 Already on top , Start your situation again : The result is the same as singleTop Pattern
4. There are already... In the stack , But not at the top :
singleInstance Pattern
One 、 Under normal circumstances, start a activity, Its life cycle :(Activity_B Do a test )
1、 start-up ->back Key returns : The result is the same as standard Pattern
2、 start-up ->home desktop -> And on again app( Without being killed ): The result is the same as standard Pattern
3、 Already on top , Start your situation again : The result is the same as singleTop Pattern4. There are already... In the stack , But not at the top : The result is the same as singleTask Pattern
Activity A start-up B Then return A A and B Life cycle changes of ( The order )

边栏推荐
- PAT 乙等 1025 反转链表
- 使用链表实现两个多项式相加和相乘
- 啊哈C语言 第7章 有了它你能做更多的事(第27-28讲)
- 雷达图canvas
- iNFTnews | 加密之家从宇宙寄来的明信片,你会收到哪一张?
- MySQL面试真题(二十五)——常见的分组比较场景
- 数字藏品到底有什么魔力?目前有哪些靠谱的团队在开发
- Heimdall Database Proxy横向扩展提高20倍
- The difference between SaaS software and traditional software delivery mode
- The performance of nonstandard sprintf code in different platforms
猜你喜欢

新课上线 | 每次 5 分钟,轻松玩转阿里云容器服务!

True MySQL interview question (24) -- row column exchange

A bit of knowledge - folding forging and Damascus steel

技能自检 | 想当测试Leader,这6项技能你会吗?

HierarchyViewer工具找不到 HierarchyViewer位置

MDM data cleaning function development description

MySQL面试真题(二十四)——行列互换

ArcTime 制作中英文字幕视频

Wechat applet: wechat can also send flash photos to create wechat applet source code download and customize flash time

Real MySQL interview questions (XXVI) -- didi 2020 written examination questions
随机推荐
JS面试题----防抖函数
技能自检 | 想当测试Leader,这6项技能你会吗?
Leetcode topic resolution divide two integers
Real MySQL interview question (30) -- shell real estate order analysis
jvm-02.有序性保证
ORB_SLAM2运行
MySQL面试真题(二十一)——金融-贷款逾期
AHA C language Chapter 8 game time is up (lesson 29)
The construction of digital factory can be divided into three aspects
使用链表实现两个多项式相加和相乘
The author believes that the so-called industrial Internet is a process of deep integration of industry and the Internet
Advanced Mathematics (Seventh Edition) Tongji University exercises 1-8 personal solutions
PAT 乙等 1023 组个最小数
jvm-01.指令重排
Opportunities and challenges of digital collections from the perspective of technology development team
Yingjixin ip5566 with type-C port 3A charging and discharging fast charging mobile power supply 5W wireless charging in one SOC
How does win11 enable mobile hotspot? How to enable mobile hotspot in win11
The performance of nonstandard sprintf code in different platforms
[graduation season u; advanced technology Er] farewell to the confused self in the past two years. Regroup, junior I'm coming
Jvm: when a method is overloaded, the specific method to call is determined by the static type of the incoming parameter rather than the actual type of the parameter




