Handle operating mechanism
Handler is to resolve the communication between threads and threads.
Handler's message processing consists of five components, message,Handler, messageQueue,Looper and ThreadLocal
Message: Messages passed between threads for exchanging data between thread
Handler: Send messages that are used primarily for sending and processing messages, typically with SendMessage (), except Sendmessageatfrontofqueue () are Sendmessageattime methods
Message Queue: Holds all messages sent through handler, this part of the message will remain in the message queue, waiting to be processed, each thread has only one messageque Ue
Looper: Every time a message is found in the messages queue, it is taken out and passed to the handler Handlemessage () method with only one Looper per thread
ThreadLocal: is a data storage class inside a thread that can store data in a specified thread, and after the data is stored, only in the specified thread can get to the data stored in the
Generic understanding
generics: allows the implementation of classes, interfaces when specifying the type parameters, improve the security of Java program Type, eliminate many of the source of the cast, the code is more readable, reduce the chance of error, use type parameter definition attribute private T class name;
Event distribution mechanism:
Event Distribution object: Click on the nature of the object event distribution: Pass the Click event to a specific
ViewWhat objects are passed between the & process events? Activity, ViewGroup, View
Android handle operating mechanism, generics, event distribution mechanism