日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

【起航计划 011】2015 起航计划 Android APIDemo的魔鬼步伐 10 App-Activity-Reorder Activities 后退栈 Intent FLAG...

發布時間:2023/12/13 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【起航计划 011】2015 起航计划 Android APIDemo的魔鬼步伐 10 App-Activity-Reorder Activities 后退栈 Intent FLAG... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Reorder Activities 示例有四個相關的Activitives: ReorderOnLaunch, ReorderTwo,ReorderThree, ReorderFour。其中ReorderOnLaunch為主Activity,ReorderOnLaunch啟動ReorderTwo ,ReorderTwo啟動 ReorderThree,ReorderThree啟動 ReorderFour。 這時在Activity的”back stack”有如下狀態:

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);

?

此時棧如下圖所示:

?

轉載于:https://www.cnblogs.com/dongdong230/p/4310553.html

總結

以上是生活随笔為你收集整理的【起航计划 011】2015 起航计划 Android APIDemo的魔鬼步伐 10 App-Activity-Reorder Activities 后退栈 Intent FLAG...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。