参考:http://developer.android.com/guide/components/tasks-and-back-stack.html#ManagingTasks
在前面一章中讲到了Android如何管理任务和返回堆栈——将所有的连续Activity安排在同一个Task中,即一个“后进,先出”的栈里。这样的方式对大多数应用程序有很好的效果,而且我们也不需要担心你的Activity如何和Task联系在一起,也不需要关系它们在“back stack”返回堆栈中是如何存在的。然而,在某些情况下,你也许会需要打破这种常规的行为。比如你需要你用用程序里面的某个Activity在一个新的Task中启动(而不是被安排在当前的Task中);或者,当你开启一个Activity的时候,你想如果它已经存在,那么就把它已经存在的实例拿到前台(而不是在返回堆栈的顶部再去创建一个新的实例);或者,你也许想当用户离开这个Task的时候,清除该返回堆栈中除了root
Activity的其他所有Activity。
通过在manifest文件中
<activity>
中添加属性和在调用
startActivity()
时为intent添加flag,来完成上面的行为,或者做其他更多的特定的行为。
在Task管理的方面,<activity>
中可用的属性如下:
可用的Intent flag如下:
在下面的章节中,你将会看到如何去使用manifest属性和intent flag来定义Activity如何和Task结合,并且是如何表现在“back stack”返回堆栈中的。
注意:大多数应用程序不需要破坏Activity Task的默认行为。如果你确定对于你的Activity,确实是需要修改这个默认行为的话,使用时一定要小心,一定要测试程序可用性活动,如在它的启动过程中和当通过后退按钮从其他的Activity和Task中返回的时候。一定要测试导航行为可能与用户的预期行为的冲突。
因为内容较多,分为几篇文章来描述:
1.6、Activity任务和返回堆栈3(Tasks and Back Stack)之LaunchMode
分享到:
相关推荐
Android学习笔记-Activity篇 Contents Android学习笔记-Activity篇 1 ...Tasks and Back Stack 4 一、管理Task 4 1.1 定义launch模式 4 1.2 设置affinities 5 1.3 清空the back stack 5 1.4 开始task 5
Bluetooth Profile
堆栈任务Stack Tasks是一个任务管理器,可以根据优先级对任务进行添加和分类。
mundane, repetitive tasks. We’ll also investigate JSHint, a linting tool used to improve code quality. Along the way, we’ll also be developing an example human resources ...
将资产远程同步到本地,将本地同步到远程命令mysql,mysqldump(或pg_dump,psql),bzip2和unbzip2(或gzip)必须位于您的PATH中随意分叉并添加更多的数据库支持或新任务。安装将其添加为宝石: gem "capistrano-db...
We study the scheduling decision for an application consisting of dependent tasks, in a generic cloud computing system comprising a network of heterogeneous local processors and a remote cloud server.
这是关于大规模学习任务算法的电子书,高清,最新版本,经典著作,英文版
mern-stack-tasks:使用MERN执行任务
多任务多线程管理模块,任务有优先级,一个任务执行完毕,按照优先级高低执行另一个任务 1)如何使用: 1. 声明一个HashTaskList,或在栈上动态获取; 2. 调用InitTaskList初始化上一步的HashTaskList 3. 调用...
使用Aspose.Tasks你可以阅读和改变任务,重现任务,资源,资源分配,关系和日历。Aspose.Tasks是一个提供稳定性和灵活性的非常成熟的产品。正如所有的Aspose.Tasks文件管理组件,Aspose.Tasks在WinForm和WebForm应用...
IEEE Standard for System and Software Verification and Validation IEEE Std 1012-2012 Front Cover -14 Title Page -12 Notice to users -9 Laws and regulations -9 Copyrights -9 Updating of IEEE ...
Action recognition and human pose estimation are closely related but both problems are generally handled as distinct tasks in the literature. In this work, we pro- pose a multitask framework for ...
1.5 as fast as possible. This book is meant to be read cover-to-cover, and all you have to do is read a page, do what it says, and go ahead. After completing all the tasks in the book, you will be a...
自定义计划任务管理工具 自己定义定时启动的计划任务 暂时只兼容winxp 2003 win7以后的系统是不兼容的
nopCommerce程序中计划任务(ScheduleTasks) 原理是:被.Net(Core)内置管道中间件所调用,以保证在程序开始启动执行时,实例化当前程序中的所有计划任务实例,并为这些任务实例构建相应的线程实例;并保证在程序其后...
Of all the tasks programmers are asked to perform, storing, compressing, and retrieving information are some of the most challenging--and critical to many applications. Managing Gigabytes: Compressing...
Section 1.5. Start and Stop Section 1.6. View Results Section 1.7. Where's My Code? Section 1.8. Macros and Security Section 1.9. Write Bug-Free Code Section 1.10. Navigate Samples and Help...
AspNetBackgroundTasks, 将"fire and forget" 任务注册到 ASP.NET 运行时的组件 重要说明介绍了 .NET 框架 4.5.2 HostingEnvironment.QueueBackgroundWorkItem ,与这里库非常相似。 请考虑升级到 4.5.2并使用 ...
一般定时任务配置都需要相互的依赖,代码量多也不简洁,也得有任务管理器管理,此版本的定时任务本着简洁而去配置只需两步 一,任务列表(多个定时任务可在task:scheduled-tasks中写多个task:scheduled-task) ...
使用 Aspose.Tasks 你可以阅读和改变任务,重现任务,资源,资源分配,关系和日历。 Aspose.Tasks 是一个提供稳定性和灵活性的非常成熟的产品。正如所有的 Aspose.Tasks 文件管理组件, Aspose.Tasks 在 WinForm 和...