The functions of various flags are collected and sorted, and only new flags are used for Supplement. Therefore, the list here is incomplete and can be updated at any time.
First, the flag usage:
1234 |
Intent it = new intent (); it. setclass (setting. This, Main. Class );// Jump from setting to mainIt. addflags (intent. flag_activity_clear_top );// Add the flagStartactivity (it ); |
According to the above example:
Without flag: If there is no flag, the above Code is to start the main, whether or not the main has been started, so the top-down order in the stack is main, setting, Main. There are two main
Flag_activity_clear_top: clears all the activities on the main (including setting, so you do not need to call the setting finish method here). If the main has been started and restarted, the stack goes from top to bottom: Main
Flag_activity_reorder_to_front: if the main has been started, the main will not be restarted. Instead, the main that is not displayed in the background will be taken to the very front, and the top-down sequence in the stack will be: Main, setting
Flag_activity_no_history: After you start main, if you switch to another activity (including pressing the return key and startactivity method), main will automatically call the finish method and will not stay in the stack.
Flag_activity_exclude_from_recents: After being started, it will not appear in the recent Startup Program that jumps out of the long-pressed home.
In addition, you can add multiple flags to addflags, and set multiple flags through |.
From: http://www.pocketdigi.com/20110406/232.html