当前位置:网站首页>Andorid development art exploration notes (2), cross platform applet development framework
Andorid development art exploration notes (2), cross platform applet development framework
2022-06-24 00:06:00 【Ordinary netizens】
- singleTop: Stack top reuse mode
In this mode, if Activity Already at the top of the stack, this Activity Will not recreate , At the same time, its onNewIntent Method will be called , Through the parameters of this method, we can get the current request information . If the new Activity Not at the top of the stack , Then it will be recreated . If the current stack is ABCD, The model is standard, To create a D, The stack becomes ABCDD, If singleTop Then for ABCD.
- singleTask: In stack reuse mode
This is a single instance mode .Activity When starting, first find out whether there is an instance in the stack , If so, set it to the top of the stack , Do not create a new instance , If it does not exist, create a new instance and push it onto the stack .
①S1 In the stack Activity by ABC, Want to start D, Then create an instance stack ,S1 Turn into ABCD.
②S1 In the stack ABC, but D The desired stack is S2,S2 non-existent , therefore S2 and D At the same time, create and transfer D Push the S2 In the stack .
③S1 In the stack ABCD, Want to be in S1 Start in B, Will CD Out of the stack ,S1 The stack becomes AB.
( All the above are in singTask In mode )
- singleInstance: Single instance mode .
It's a kind of reinforcement singleTask Pattern , So it has singleTask The function of mode , A little bit stronger , That's the pattern Activity It can only be located on one task stack .Activity A In this mode, it can only be located on the stack S1 in ,Activity B Can only be located separately on the stack S2 in .
< About TaskAffinity>
It marks a Activity The name of the required task stack . By default, it's all Activity The package name of the app . So it's connected to singleTask Pairs using . One more parameter allowTaskReparenting, If it is True also singleTask Next , that When one Activity A start-up B One of them Activity, When B Startup time , This Activity Your task stack will start from A Transfer to B.
You can do this by Menifest Start mode is specified in , You can also get it from Acitivity Of addFlags Set the flag bit to specify the startup mode . In terms of priority , The latter is higher than the former . And the limited scope of the two methods is also different , The former cannot be specified FLAG_ACTIVITY_CLEAR_TOP identification , The latter cannot be Activity Appoint singleInstance Pattern .
In the book is singleTask An example is introduced to illustrate its operation :
A by standard Pattern , So its TaskAffinity Is the default package name S1,B and C Are all singleTask Pattern ,TaskAffinity by S2.A Start... First B,B Then start C, At this time, the stack is :S1 There are only A, because B and C need S2 Task stack , therefore B Created S2 Stack ,S2 In the stack BC. then C start-up A, This time because A yes standard Pattern , So it will go to the one that created it Actvitiy namely C In the stack of , therefore S2 Stack becomes BCA,S1 Stack as A. next A start-up B, because B by singleTask Pattern , therefore S2 Medium CA All pop up the stack to let B To the top of the stack , here S2 Stack as B. Then press the back key ,S2 Stack Actviity Be taken out , Backstage S1 The stack is put into the foreground . and S1 Only A, But this A Not at all S2 Stack but S1 Stack . next A Press the return key in the , Of all stacks Activity Be taken out , Back to the desktop .
Here are some examples singleTask To understand the task stack diagram :
《Android Summary of learning notes + Latest mobile architecture video + Big Android interview questions + Project actual combat source code handout 》
【docs.qq.com/doc/DSkNLaERkbnFoS0ZF】 Full content open source sharing


< About Activity Of Flags>
- FLAG_ACTIVITY_NEW_TASK
Designated as singleTask Pattern
边栏推荐
- Different objects use the same material and have different performances
- When the IOT network card device is connected to easycvr, how can I view the streaming IP and streaming time?
- 【图像检测显著图】基于matlab失真提示鱼眼图显著图计算【含Matlab源码 1903期】
- 微信小程序中three.js的canvas非全屏情况下射线检测不准确问题解决方案
- 如何利用数仓创建时序表
- Test - use case - detail frenzy
- Recommend 4 flutter heavy open source projects
- 重载(Overload)和重写(Override)的区别?
- Complete collection of development environment configuration -- Visual Studio 2022 installation
- Principles and differences between hash and history
猜你喜欢

Cloud native architecture (05) - Application Architecture Evolution

Expander+listbox of WPF effect

WPF效果之Expander+ListBox

Tupu software intelligent wind power: operation and maintenance of digital twin 3D wind turbine intelligent equipment

医疗是什么?AI医疗概念解析AI

Usage of go in SQL Server

Dot and cross product

量化投资模型——高频交易做市模型相关(Avellaneda & Stoikov’s)研究解读&代码资源

【数字信号】基于matlab模拟窗函数频谱细化【含Matlab源码 1906期】

解决项目依赖报红问题
随机推荐
Andorid 开发艺术探索笔记(2),跨平台小程序开发框架
Classical Chinese can be programmed???
New function of lightweight application server: simple experience of offline business migration by using image sharing
Summary of common register bit operation modes in MCU
人工智能技术岗位面试要注意什么?
Jimureport building block report - table linkage chart topic
Notepad++实用功能分享(正则行尾行首替换常用方法、文本比对功能等)
Startup process analysis of APP performance optimization
Principles and differences between hash and history
docker 部署redis
Keywords such as extern and struct
Android - JNI 开发你所需要知道的基础,Android工程师面试题
Salesforce Future method in salesforce – @future
Smart doc + Torna compatible version
.NET 中的 Worker Service 介绍
点乘和叉乘
【Bug】C# IQueryable里的元素更改不了值
Throttling and anti shake
Expander+listbox of WPF effect
抖音实战~手机号密码一键注册登录流程(限制手机终端登录)