当前位置:网站首页>Four startup modes of Activity
Four startup modes of Activity
2022-08-11 07:51:00 【is a small A】
One.standard:
The default startup mode of the system, stack structure, first in, last out, open an activity and push it into the stack, then open the next activity, and then push into the stack. The activities we usually create directly are all activities in this mode
The characteristics of Activity in this mode are: as long as you create an Activity instance, once the Activity is activated, the newly created instance will be added to the task stack, and if you exit the Activity, the instance will be destroyed in the task stack.
two.singleTop:
If an Activity activates itself, that is, the top of the task stack is the Activity, it does not need to be created, and an Activity instance must be created in other cases;
Three.singleTask:
If the instance of the Activity to be activated exists in the task stack, you don't need to create it. You only need to put the Activity on the top of the stack, and pop all Activity instances above the Activity;
four.singleInstance:
If we set an activity to this singleStance startup mode, then when the activity is activated, it will be placed on a separate stack, and the next time it is used, the stack will be used directly. For example, the calling application is started in a singleStance mode.activity
There are two ways to implement the code
The first one configures the desired startup mode in AndroidMainfest
The second configuration is in Java code
Intent intent = new Intent(MainActivity.this,SecondActivity.class);intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);// do logic processing herestartActivity(intent);
边栏推荐
- Production and optimization of Unity game leaderboards
- redis操作
- Pytorch模型转ONNX模型
- maxwell concept
- 1051 Multiplication of Complex Numbers (15 points)
- Strongly recommend an easy-to-use API interface
- Unity3D 学习路线?
- 【Pytorch】nn.PixelShuffle
- oracle19c does not support real-time synchronization parameters, do you guys have any good solutions?
- There may be fields that cannot be serialized in the abnormal object of cdc and sqlserver. Is there anyone who can understand it? Help me to answer
猜你喜欢
MindManager2022全新正式免费思维导图更新
Pinduoduo API interface
STM32CUBEIDE(11)----输出PWM及修改PWM频率与占空比
prometheus学习4Grafana监控mysql&blackbox了解
1071 小赌怡情 (15 分)
1002 写出这个数 (20 分)
【LaTex-错误和异常】\verb ended by end of line.原因是因为闭合边界符没有在\verb命令所属行中出现;\verb命令的正确和错误用法、verbatim环境的用法
TF中的四则运算
【LeetCode每日一题】——682.棒球比赛
tf.cast(),reduce_min(),reduce_max()
随机推荐
为什么C#中对MySQL不支持中文查询
LeetCode刷题系列 -- 46. 全排列
prometheus学习4Grafana监控mysql&blackbox了解
1081 Check Password (15 points)
Service的两种启动方式与区别
Pinduoduo API interface
1101 B是A的多少倍 (15 分)
js判断图片是否存在
MySQL使用GROUP BY 分组查询时,SELECT 查询字段包含非分组字段
1056 组合数的和 (15 分)
恒源云-Pycharm远程训练避坑指南
easyrecovery15数据恢复软件收费吗?功能强大吗?
Depth (relay supervision)
1002 写出这个数 (20 分)
TF中的四则运算
Pico neo3 Unity打包设置
2021-08-11 for循环结合多线程异步查询并收集结果
Unity3D 学习路线?
进制转换间的那点事
从何跟踪伦敦金最新行情走势?