簡體   English   中英

如何完成除主活動之外的所有活動並調用另一個活動

[英]How to finish all Activities except Main Activity and call another Activity

我正在我的應用程序中實現抽屜導航。 單擊抽屜菜單列表中的每個項目時,我將調用另一個活動,並且此抽屜導航在每個活動中均實現。

現在,我想在每次單擊項目時調用活動時清除BackStack,因此,如果我按“后退”按鈕,則不應有用戶從中跳到當前活動的上一個活動。

像這樣-

Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |  Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM