1. There are four ways to start the activity (Android:launchmode)
(1) Standard: default mode, do not configure again
The Standart mode is a stack mode, and by default each jump to a new activity will create a new instance, regardless of whether the instance exists. Each jump on the new, press stack, each return on the pop stack.
(2) Singletop: android:launchmode= "Singletop" is specified for <activity>, and the stack top reuse mode.
Each time you judge the stack top there is no, no, create; have, continue to use. If a corresponding activity is found at the top of the stack, it is reused and does not create a new one.
(3) Singletask: Specifies the android:launchmode= "Singletask" for the <activity> attribute, the unique mode.
For example, if you jump from secondactivity instance to firstactivity, you can secondactivity the stack without creating a new
Features: Each activity instance is unique, and as long as the stack exists, it pops up all of his activity. Ensures uniqueness of each activity instance
(4) SingleInstance: A relatively unique pattern, each activity will have a single stack, this stack only allow the activity of the instance into the stack
2. Service A total of two start-up methods (to be perfected)
(1) Context.startservice () mode start: OnCreate ()--onstartcommand (OnStart () obsolete)--ondestory ()
Once the service is turned on, the service has nothing to do with the caller. The server will continue in the background, regardless of whether the opener is launched or hung.
(2) Context.bindservice () mode start: OnCreate ()--onbind ()--onunbind ()--ondestory ()
Bind mode to open the service, service bindings, the caller hangs, the server will also hang up, the binder can invoke the service inside the method.
Android--activity and how the service is started