当前位置:网站首页>Activity的启动模式
Activity的启动模式
2022-07-17 00:09:00 【明天下】
Activity的启动模式
一、standard模式
特点:1.Activity的默认启动模式
2.每启动一个Activity就会在栈顶创建一个新的实例。例如:闹钟程序
缺点:当Activity已经位于栈顶时,而再次启动Activity时还需要在创建一个新的实例,不能直接复用。二、singleTop模式
特点:该模式会判断要启动的Activity实例是否位于栈顶,如果位于栈顶直接复用,否则创建新的实例。 例如:浏览器的书签
缺点:如果Activity并未处于栈顶位置,则可能还会创建多个实例。
三、singleTask模式
特点:使Activity在整个应用程序中只有一个实例。每次启动Activity时系统首先检查栈中是否存在当前Activity实例,如果存在则直接复用,并把当前Activity之上所有实例全部出栈。例如:浏览器主界面
四、singleInstance模式
特点:该模式的Activity会启动一个新的任务栈来管理Activity实例,并且该实例在整个系统中只有一个。无论从那个任务栈中 启动该Activity,都会是该Activity所在的任务栈转移到前台,从而使Activity显示。主要作用是为了在不同程序中共享一个Activity实例。
边栏推荐
- Database connection pool and serialize to realize operations such as adding, deleting, changing and querying
- 2章 性能平台GodEye源码分析-数据模块
- binary search
- 知名啤酒百威布局NFT,试图揭开“蓄谋已久”的上链面纱?
- Today's codefarmer girl summed up the notes on the difference between the method of jQuery processing cache and the method of event delegation
- [ahu2021 school competition] EZ injection
- Common asynchronous sending code writing
- NFT IP授权热度渐起,NFT2.0时代即将到来?
- What are the NFT digital collection platforms? Which platforms are worth collecting?
- 6章 性能平台GodEye源码分析-自定义拓展模块
猜你喜欢
随机推荐
IPFs file persistence operation
5G专网在智慧医疗中的应用
NameNode 和 SecondaryNameNode
基于开源流批一体数据同步引擎ChunJun数据还原—DDL解析模块的实战分享
12 至少是其他数字两倍的最大数
Xcode11添加引导页(升级后Launch Images Source选项不见了)
Today, the code farmer girl made notes about the life cycle and practiced the dynamic clock
nft发行价格是多少(解读NFT建立起NFT世界观)
Introduction to software vulnerability analysis (III)
TCP and UDP, TCP server and client, UDP server and client
开源项目丨 Taier 1.1 版本正式发布,新增功能一览为快
Redis suddenly slowed down?
Cocos Creator 3.0 基础——事件系统
Database programming (MySQL) of node, adding, deleting, modifying and querying
The popularity of NFT IP licensing is rising, and the era of nft2.0 is coming?
Iptables and snort basic configuration
我已经妥协了 大家既然都要叫我yelin 那我也没办法了
通感一体去蜂窝超大规模MIMO与高频段无线接入技术
通信感知一体化应用场景、关键技术和网络架构
5章 性能平台GodEye源码分析-第三方模块



![[ahu2021 school competition] EZ injection](/img/44/644c27f86cbbc9c6630249d2111066.png)





