简体   繁体   中英

Is there a way to set an android activities attributes conditionally?

In my Android application I have an activity where I've been using [Activity(NoHistory=true)] to keep the activity from appearing on the activity stack.

Now I'd like to make it conditional - sometimes it should be on the activity stack so the user can press Back to return to it from a subsequent screen; sometimes it shouldn't. Is there a way to "decorate" an activity conditionally or must I write some code to accomplish this?

Thanks in advance.

Are you looking for intent flags that can be set like the one below ? You could use that to start an activity and set the flag conditionally.

intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM