ActivityStack和TaskRecord有什么区别 [英] what is the difference between ActivityStack and TaskRecord

查看:142
本文介绍了ActivityStack和TaskRecord有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究AOSP,并且在"ActivityStack"类中找到了ActivityStack和TaskRecord.在 https://developer.android.com/guide/中有解释组件/任务和后退堆栈,后退堆栈(= Activity Stack)和Task似乎与我相似... ActivityStack和TaskRecord有什么区别?

I'm studying with AOSP, and I found ActivityStack and TaskRecord in "ActivityStack" Class. There is explanation In https://developer.android.com/guide/components/tasks-and-back-stack , Back-stack(=Activity Stack) And Task seems similar to me... What is the the difference between ActivityStack and TaskRecord?

推荐答案

如果将活动回溯栈视为两个级别,则可能更容易理解ActivityStack的目的.Android支持launchMode和taskAffinity将活动放入不同的TaskRecords中.但是,即使活动被放入不同的TaskRecords中,它仍支持后退按钮以切换回上一个活动.因此,当您启动需要在新TaskRecord中的活动时,然后按返回按钮,它将切换到先前TaskRecord的顶部活动.因此,ActivityStack更像是TaskRecord堆栈,而TaskRecord更像是TaskRecord内部的活动堆栈,但是,一般而言,ActivityStack控制弹出序列,并且可以说它是间接活动堆栈.

If you think of activity back stack as two levels, it might be easier to understand the purpose of ActivityStack. Android supports launchMode and taskAffinity to put activities into different TaskRecords. But even activities are put into different TaskRecords, it keeps supporting the back button to switch back to previous activity. So when you launch activity that needs to be in new TaskRecord, then back button is pressed, it switches to top activity of previous TaskRecord. So ActivityStack is more like a TaskRecord stack, and TaskRecord is more like the activity stack inside the TaskRecord, however, general speaking, ActivityStack controls the pop up sequence, and you can say it's an indirect activity stack.

在多个窗口环境中创建ActivityStack似乎在逻辑上使管理更加容易.如果您在Android中启用自由格式,则每个启动的窗口模式应用程序都有其自己的自由格式堆栈,并且每个堆栈都有其自己的后堆栈.

And creating ActivityStack seems to make management easier logically in multiple window environment. If you enable free form in Android, each launched window mode app has its own free form stack, and each stack has its own back stack.

我的2c.

这篇关于ActivityStack和TaskRecord有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆