Application application, like Activity,service, is a system component of the Android framework, and the Android system creates an object of the application class for each program runtime and creates only one, So application can be said to be a class of Singleton (singleton) mode. And the life cycle of the Application object is the longest in the whole program, and its life cycle is equal to the program's life cycle. Because it is a global singleton, the objects obtained in different activity,service are the same object. So through the application to do some, data transfer, data sharing, such as data caching operations.
Handle when we are dealing with downloads or other tasks that need to be performed for a long time, if you put the handler function directly in the activity's OnCreate or onstart, it will cause the entire activity to be unresponsive during execution, and if the time is too long, the program will hang. handler is the ability to put these functions into a separate thread to execute, and not affect the activity. When processing is complete, sending a message tells the activity that it is equivalent to asynchronous processing.
Task, simply put, is a collection of activity components that are clustered together in a stack of patterns. They have potential pre-and post-drive associations, the newly added activity component, at the top of the stack, and only activity at the top of the stack, before they have the opportunity to interact with the user. When the activity at the top of the stack completes its mission, the task will pull it out and let the next activity that will run to the top of the stack come to the user until there is no more activity,task end in the stack.
Application+handle+task