[Android Samples视频系列之ApiDemos] App-Activity-Reorder Activities

[b]1.Demo说明与演示[/b]
该Demo主要演示FLAG_ACTIVITY_REORDER_TO_FRONT的使用
效果图如下:

[img]http://dl.iteye.com/upload/attachment/0077/1048/2fdd4fc2-b801-398a-8be5-849d186dc9b2.png[/img]

[b][color=red]2.视频讲解[/color][/b]
[url]http://www.eyeandroid.com/thread-10717-1-1.html[/url]

[b]3.Demo分析[/b]
Reorder Activities 示例有四个相关的Activitives: ReorderOnLaunch, ReorderTwo,ReorderThree, ReorderFour。其中ReorderOnLaunch为主Activity,ReorderOnLaunch启动ReorderTwo ,ReorderTwo启动 ReorderThree,ReorderThree启动 ReorderFour。

ReorderFour 想再启动ReorderTwo, 这时用两种实现方法,一是在 RecordFour之上再启动一个新的 ReorderTwo ,这是startActivity的缺省行为。这是因为在AndroidManifest.xml
<activity android:name=”.app.ReorderTwo” />
<activity android:name=”.app.ReorderThree” />
<activity android:name=”.app.ReorderFour” />
.app.RecordTwo没有定义任何这个Intent的Flag。 比如有 FLAG_ACTIVITY_NEW_TASK,FLAG_ACTIVITY_CLEAR_TOP,FLAG_ACTIVITY_SINGLE_TOP,在这些情况下 Android将根据不同Flag设置来决定启动RecordTwo的方法,具体在后面的例子会有介绍。
在Reorder Activities例子中,是将“Back Stack”中的ReorderTwo移到栈顶,方法是在启动Intent时设置Intent.FLAG_ACTIVITY_REORDER_TO_FRONT。如果设置了FLAG_ACTIVITY_REORDER_TO_FRONT表示将“Back Stack”中指定的Activity移动到栈顶。
Intent intent = new Intent(ReorderFour.this, ReorderTwo.class);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值