First, the Android Launchmode
A total of four startup modes
1. Standard
Standard startup mode, activity's default startup mode. Create a new sample every time the activity is started
2, Singletop
The stack-top multiplexing mode, when the active activity is at the top of the stack, no longer creates a new live instance. The callback Onnewintent method.
3, Singletask
In-stack multiplexing mode, when the activated activity has an instance in a stack, no new instances are created, and all instances that pop up above it are placed on top of the stack. The Onnewintent method is also recalled.
4, SingleInstance
Single-instance mode, which specifies that instances of activity for this pattern can only be in one task stack alone.
The startup mode can be specified in two ways, one is the Launchmode property of the activity, and the other is to call intent's Addflags method to specify flag for it. Commonly used are:
1, Flag_activity_new_task
Equivalent to Singletask mode
2, Flag_activity_single_top
i.e. Singletop mode
3, Flag_activity_clear_top
Instances that are on top of the activity are stacked, and even in standard mode, the instance is recreated after the stack is out.
4, Flag_activity_exclude_from_recents
Excluded from the Activity History list, which cannot be returned by back.
Other properties that are used in a common package
1, Taskaffinity
Specifies the starting stack for activty, which is used in conjunction with Singletask or allowtaskreparenting
2, Allowtaskreparenting
The primary role is the migration of the activity, that is, migrating from one task to another, which is related to the taskaffinity of the activity and must be from an activity Taskaffinity a different task into the same task as it taskaffinity.
Activation of activity (e.g. screen rotation, etc.) under abnormal circumstances
At this point the activity destroys the rebuild (Ondestory-->oncreate), invokes Onsaveinstancestate to save the data, and Onrestoreinstancestate recovers the data.
You can specify the Configchanges property to make the activity not rebuild
The commonly used values are:
1, locale is generally switched system language
2, orientation screen needs to be rotated (api>13, need to specify screensize)
3, the Keyboardhidden keyboard accessibility changes.
Second, the matching rules of Intentfilter
A total of three seed attributes--action, category, data, only three are matched at the same time, the corresponding activity will start.
Match rule: Action requires the specified action and must exist.
Category is not specified, intent will add category (Android.intent.category.DEFAULT) by default, so activity that needs to be implicitly called must add the default category.
Data consists of Mimtype (resource type) and URI
Uri:scheme://hast:port/path | Pathprefix/pathpattern
The URI default value for content or file,intent is specified when the Setdataandtype method is called and cannot be specified separately because the two methods will overwrite each other.
Android boot mode and intentfilter matching rules